19 __authors__ = [ |
19 __authors__ = [ |
20 '"Pawel Solyga" <pawel.solyga@gmail.com>', |
20 '"Pawel Solyga" <pawel.solyga@gmail.com>', |
21 ] |
21 ] |
22 |
22 |
23 from google.appengine.ext import db |
23 from google.appengine.ext import db |
|
24 |
24 from django.utils.translation import ugettext_lazy |
25 from django.utils.translation import ugettext_lazy |
|
26 |
|
27 from soc.models import base |
25 import soc.models.user |
28 import soc.models.user |
26 |
29 |
27 class Document(db.Model): |
30 |
|
31 class Document(base.ModelWithFieldAttributes): |
28 """Model of a Document. |
32 """Model of a Document. |
29 |
33 |
30 Document is used for things like FAQs, front page text etc. |
34 Document is used for things like FAQs, front page text etc. |
31 """ |
35 """ |
32 |
36 |
|
37 #: Document title displayed on the top of the page |
33 title = db.StringProperty(required=True, |
38 title = db.StringProperty(required=True, |
34 verbose_name=ugettext_lazy('Title')) |
39 verbose_name=ugettext_lazy('Title')) |
35 title.help_text = ugettext_lazy('Document title displayed on the top of the page') |
40 title.help_text = ugettext_lazy( |
|
41 'Document title displayed on the top of the page') |
36 |
42 |
|
43 #: Document link name used in URLs |
37 link_name = db.StringProperty(required=True, |
44 link_name = db.StringProperty(required=True, |
38 verbose_name=ugettext_lazy('Link name')) |
45 verbose_name=ugettext_lazy('Link name')) |
39 link_name.help_text = ugettext_lazy('Document link name used in URLs') |
46 link_name.help_text = ugettext_lazy('Document link name used in URLs') |
40 |
47 |
|
48 #: Document short name used for sidebar menu |
41 short_name = db.StringProperty(required=True, |
49 short_name = db.StringProperty(required=True, |
42 verbose_name=ugettext_lazy('Short name')) |
50 verbose_name=ugettext_lazy('Short name')) |
43 short_name.help_text = ugettext_lazy('Document short name used for sidebar menu') |
51 short_name.help_text = ugettext_lazy( |
|
52 'Document short name used for sidebar menu') |
44 |
53 |
|
54 #: Content of the document |
45 content = db.TextProperty( |
55 content = db.TextProperty( |
46 verbose_name=ugettext_lazy('Content')) |
56 verbose_name=ugettext_lazy('Content')) |
47 |
57 |
|
58 #: Date when the document was created. |
48 created = db.DateTimeProperty(auto_now_add=True) |
59 created = db.DateTimeProperty(auto_now_add=True) |
|
60 |
|
61 #: Date when the document was modified. |
49 modified = db.DateTimeProperty(auto_now=True) |
62 modified = db.DateTimeProperty(auto_now=True) |
|
63 |
|
64 #: User who created this document. |
50 user = db.ReferenceProperty(reference_class=soc.models.user.User, |
65 user = db.ReferenceProperty(reference_class=soc.models.user.User, |
51 required=True, collection_name='documents') |
66 required=True, collection_name='documents') |
52 |
67 |
53 |
68 |
54 |
69 |