18 |
18 |
19 __authors__ = [ |
19 __authors__ = [ |
20 '"Pawel Solyga" <pawel.solyga@gmail.com>', |
20 '"Pawel Solyga" <pawel.solyga@gmail.com>', |
21 ] |
21 ] |
22 |
22 |
|
23 |
23 from google.appengine.ext import db |
24 from google.appengine.ext import db |
|
25 |
|
26 import polymodel |
24 |
27 |
25 from django.utils.translation import ugettext_lazy |
28 from django.utils.translation import ugettext_lazy |
26 |
29 |
27 from soc.models import base |
|
28 import soc.models.user |
30 import soc.models.user |
|
31 import soc.models.work |
29 |
32 |
30 |
33 |
31 class Document(base.ModelWithFieldAttributes): |
34 class Document(soc.models.work.Work): |
32 """Model of a Document. |
35 """Model of a Document. |
33 |
36 |
34 Document is used for things like FAQs, front page text etc. |
37 Document is used for things like FAQs, front page text, etc. |
|
38 |
|
39 The specific way that the properties and relations inherited from Work |
|
40 are used with a Document are described below. |
|
41 |
|
42 work.title: the title of the Document |
|
43 |
|
44 work.abstract: document summary displayed as a snippet in Document |
|
45 list views |
|
46 |
|
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 |
35 """ |
51 """ |
36 |
52 |
37 #: Document title displayed on the top of the page |
53 #: Required db.TextProperty containing the Document contents. |
38 title = db.StringProperty(required=True, |
54 #: Unlike the work.abstract, which is considered "public" information, |
39 verbose_name=ugettext_lazy('Title')) |
55 #: the content is only to be displayed to Persons in Roles eligible to |
40 title.help_text = ugettext_lazy( |
56 #: view them (which may be anyone, for example, with the site front page). |
41 'Document title displayed on the top of the page') |
57 content = db.TextProperty(verbose_name=ugettext_lazy('Content')) |
42 |
|
43 #: Document link name used in URLs |
|
44 link_name = db.StringProperty(required=True, |
|
45 verbose_name=ugettext_lazy('Link name')) |
|
46 link_name.help_text = ugettext_lazy('Document link name used in URLs') |
|
47 |
|
48 #: Document short name used for sidebar menu |
|
49 short_name = db.StringProperty(required=True, |
|
50 verbose_name=ugettext_lazy('Short name')) |
|
51 short_name.help_text = ugettext_lazy( |
|
52 'Document short name used for sidebar menu') |
|
53 |
|
54 #: Content of the document |
|
55 content = db.TextProperty( |
|
56 verbose_name=ugettext_lazy('Content')) |
|
57 |
|
58 #: Date when the document was created. |
|
59 created = db.DateTimeProperty(auto_now_add=True) |
|
60 |
|
61 #: Date when the document was modified. |
|
62 modified = db.DateTimeProperty(auto_now=True) |
|
63 |
58 |
64 #: User who created this document. |
59 #: User who created this document. |
|
60 #: TODO(pawel.solyga): replace this with WorkAuthors relation |
65 user = db.ReferenceProperty(reference_class=soc.models.user.User, |
61 user = db.ReferenceProperty(reference_class=soc.models.user.User, |
66 required=True, collection_name='documents') |
62 required=True, collection_name='documents') |
67 |
63 |
68 |
|
69 |
|