app/soc/models/work.py
changeset 54 03e267d67478
parent 16 300f7606e100
child 181 fdd29818a954
equal deleted inserted replaced
53:57b4279d8c4e 54:03e267d67478
       
     1 #!/usr/bin/python2.5
       
     2 #
       
     3 # Copyright 2008 the Melange authors.
       
     4 #
       
     5 # Licensed under the Apache License, Version 2.0 (the "License");
       
     6 # you may not use this file except in compliance with the License.
       
     7 # You may obtain a copy of the License at
       
     8 #
       
     9 #   http://www.apache.org/licenses/LICENSE-2.0
       
    10 #
       
    11 # Unless required by applicable law or agreed to in writing, software
       
    12 # distributed under the License is distributed on an "AS IS" BASIS,
       
    13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    14 # See the License for the specific language governing permissions and
       
    15 # limitations under the License.
       
    16 
       
    17 """This module contains the Work Model."""
       
    18 
       
    19 __authors__ = [
       
    20   '"Todd Larsen" <tlarsen@google.com>',
       
    21   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
       
    22 ]
       
    23 
       
    24 from google.appengine.ext import db
       
    25 
       
    26 
       
    27 class Work(db.Model):
       
    28   """Model of a Work created by one or more Authors.
       
    29 
       
    30   Work is a "base entity" of other more specific "works" created by "authors".
       
    31 
       
    32   A Work entity participates in the following relationships implemented
       
    33   as a db.ReferenceProperty elsewhere in another db.Model:
       
    34 
       
    35    proposal), survey), documentation)
       
    36      a 1:1 relationship with each entity containing a more specific type of
       
    37      "work".  These relationships are represented explicitly in the other
       
    38      "work" models by a db.ReferenceProperty named 'work'.  The
       
    39      collection_name argument to db.ReferenceProperty should be set to the
       
    40      singular of the entity model name of the other "work" class.  The above
       
    41      relationship names correspond, respectively to these Models:
       
    42        Proposal, Survey, Documentation
       
    43      The relationships listed here are mutually exclusive.  For example,
       
    44      a Work cannot be both a Proposal and a Survey at the same time.
       
    45 
       
    46    authors)  a many:many relationship with Authors, stored in a separate
       
    47      WorksAuthors model.  See the WorksAuthors model class for details.
       
    48 
       
    49    reviews)  a 1:many relationship between a Work and the zero or more
       
    50      Reviews of that Work.  This relation is implemented as the 'reviews'
       
    51      back-reference Query of the Review model 'reviewed' reference.
       
    52   """
       
    53 
       
    54   #: Required field indicating the "title" of the work, which may have
       
    55   #: different uses depending on the specific type of the work. Works
       
    56   #: can be indexed, filtered, and sorted by 'title'.
       
    57   title = db.StringProperty(required=True)
       
    58 
       
    59   #: large, non-indexed text field used for different purposes, depending
       
    60   #: on the specific type of the work.
       
    61   abstract = db.TextProperty()