author | Todd Larsen <tlarsen@google.com> |
Wed, 01 Oct 2008 02:23:30 +0000 | |
changeset 231 | e2782aacfec7 |
parent 206 | 832335761384 |
child 342 | 72482d8e5b34 |
permissions | -rw-r--r-- |
21
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
2 |
# |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
4 |
# |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
8 |
# |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
10 |
# |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
16 |
|
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
17 |
"""This module contains the Documentation Model.""" |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
18 |
|
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
19 |
__authors__ = [ |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
20 |
'"Todd Larsen" <tlarsen@google.com>', |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
22 |
] |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
23 |
|
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
24 |
|
21
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
25 |
from google.appengine.ext import db |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
26 |
|
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
27 |
import soc.models.role |
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
54
diff
changeset
|
28 |
import soc.models.work |
21
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
29 |
|
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
30 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
31 |
class Documentation(soc.models.work.Work): |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
32 |
"""Model of Documentation, which is a Work authored by Administrators. |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
33 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
34 |
Documentation is items like tax forms, letters from schools confirming |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
35 |
enrollment, etc., (often scanned in) that are attached to a Role as |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
36 |
documentation related to that Role. |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
37 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
38 |
The specific way that some properties and relations inherited from Work |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
39 |
are used with a piece of Documentation are described below. |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
40 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
41 |
work.title: The title of the Documentation (e.g. "Verification |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
42 |
of Eligibility"). |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
43 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
44 |
work.abstract: Summary of the contents of the 'attachment', or |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
45 |
just an indication that the required documentation was |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
46 |
supplied but is not actually attached. |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
47 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
48 |
work.authors: The Authors of the Work referred to by this |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
49 |
relation are the Administrators (or Hosts) creating the |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
50 |
Documentation. |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
51 |
|
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
52 |
work.reviews: Annotations to the Documentation made by other |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
53 |
Administrators. |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
54 |
""" |
21
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
55 |
|
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
56 |
#: a many:1 relationship of Documentation entities that pertain |
206
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
57 |
#: to a single Role. The back-reference in the Role model is a |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
58 |
#: Query named 'documentation'. |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
59 |
role = db.ReferenceProperty(reference_class=soc.models.role.Role, |
832335761384
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
60 |
collection_name='documentation') |
21
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
61 |
|
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
62 |
#: An optional db.BlobProperty containing the documentation |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
63 |
#: (usually a scanned image of a paper document or a PDF file). |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
64 |
attachment = db.BlobProperty() |
6edf98d9c739
Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
65 |