app/soc/models/document.py
changeset 342 72482d8e5b34
parent 338 0d78f41dde9b
child 351 b37fc4c1e189
equal deleted inserted replaced
341:cad57d104bc7 342:72482d8e5b34
    19 __authors__ = [
    19 __authors__ = [
    20   '"Pawel Solyga" <pawel.solyga@gmail.com>',
    20   '"Pawel Solyga" <pawel.solyga@gmail.com>',
    21 ]
    21 ]
    22 
    22 
    23 
    23 
    24 import polymodel
       
    25 
       
    26 from google.appengine.ext import db
    24 from google.appengine.ext import db
    27 
    25 
    28 from django.utils.translation import ugettext_lazy
    26 from django.utils.translation import ugettext_lazy
    29 
    27 
    30 import soc.models.user
       
    31 import soc.models.work
    28 import soc.models.work
    32 
    29 
    33 
    30 
    34 class Document(soc.models.work.Work):
    31 class Document(soc.models.work.Work):
    35   """Model of a Document.
    32   """Model of a Document.
    42     work.title:  the title of the Document
    39     work.title:  the title of the Document
    43 
    40 
    44     work.abstract:  document summary displayed as a snippet in Document
    41     work.abstract:  document summary displayed as a snippet in Document
    45       list views
    42       list views
    46 
    43 
    47     work.authors:  the Authors of the Work referred to by this relation
       
    48       are the authors of the Document
       
    49 
       
    50     work.reviews:  reviews of the Document by Reviewers
    44     work.reviews:  reviews of the Document by Reviewers
    51   """
    45   """
    52 
    46 
    53   #: Required db.TextProperty containing the Document contents.
    47   #: Required db.TextProperty containing the Document contents.
    54   #: Unlike the work.abstract, which is considered "public" information,
    48   #: Unlike the work.abstract, which is considered "public" information,
    55   #: the content is only to be displayed to Persons in Roles eligible to
    49   #: the content is only to be displayed to Persons in Roles eligible to
    56   #: view them (which may be anyone, for example, with the site front page).
    50   #: view them (which may be anyone, for example, with the site front page).
    57   content = db.TextProperty(verbose_name=ugettext_lazy('Content'))
    51   content = db.TextProperty(verbose_name=ugettext_lazy('Content'))
    58   
       
    59   #: TODO(pawel.solyga): replace this with WorkAuthors relation
       
    60   #: Required many:1 relationship indicating the founding User of the
       
    61   #: Document (this relationship is needed to keep track of lifetime document
       
    62   #: creation limits, used to prevent spamming, etc.).
       
    63   founder = db.ReferenceProperty(reference_class=soc.models.user.User,
       
    64                                  required=True, collection_name="documents",
       
    65                                  verbose_name=ugettext_lazy('Created by'))
       
    66