app/soc/models/author.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Sat, 13 Sep 2008 22:00:51 +0000
changeset 141 e120c24b89e2
parent 54 03e267d67478
permissions -rw-r--r--
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code. Patch by: Pawel Solyga Review by: to-be-reviewed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
# 
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
# 
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
"""This module contains the Author Model."""
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
__authors__ = [
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
  '"Todd Larsen" <tlarsen@google.com>',
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
]
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
from google.appengine.ext import db
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
from soc import models
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
import soc.models.person
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
class Author(db.Model):
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
  """Author details for a specific Program.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
  An Author entity participates in the following relationships implemented 
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
  as a db.ReferenceProperty elsewhere in another db.Model:
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
   works)  a many:many relationship with Works, stored in a separate
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
     WorksAuthors model.  See the WorksAuthors model class for details.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
   contributor)  a 1:1 relationship associating a Contributor with generic
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
     Author details and capabilities.  This relation is implemented as the
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
     'contributor' back-reference Query of the Contributor model 'author'
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
     reference.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
   reviewer)  a 1:1 relationship associating a Reviewer with generic
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
     Author details and capabilities.  This relation is implemented as the
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
     'reviewer' back-reference Query of the Reviewer model 'author' reference.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
   admin)  a 1:1 relationship associating an Administrator with generic
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
     Author details and capabilities.  This relation is implemented as the
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
     'admin' back-reference Query of the Administrator model 'author'
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
     reference.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
  """
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
  #: A required 1:1 relationship associating generic Person details
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    55
  #: with the Author role entity.
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    56
  person = db.ReferenceProperty(reference_class=models.person.Person, 
bdb96b9afe8e Initial implementation of the Author Model in the author.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    57
		  		required=True, collection_name="author")