author | Chen Lunpeng <forever.clp@gmail.com> |
Sat, 18 Oct 2008 05:59:04 +0000 | |
changeset 381 | 8b9e8f5d119b |
parent 207 | 8ecc2e4198cd |
child 385 | 6d410bf49a82 |
permissions | -rw-r--r-- |
207
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
2 |
# |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
4 |
# |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
8 |
# |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
10 |
# |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
16 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
17 |
"""This module contains the Administrator Model.""" |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
18 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
19 |
__authors__ = [ |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
20 |
'"Todd Larsen" <tlarsen@google.com>', |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
21 |
] |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
22 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
23 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
24 |
from google.appengine.ext import db |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
25 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
26 |
import soc.models.person |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
27 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
28 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
29 |
class Role(soc.models.person.Person): |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
30 |
"""Information common to Program participation for all Roles. |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
31 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
32 |
Role is the entity that is created when a Person actually participates |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
33 |
in some fashion in a Program. Person details could *possibly* be collected |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
34 |
without actual participation (voluntary, opt-in, of course). |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
35 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
36 |
A Role is a Person's participation in a single Program. To avoid |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
37 |
duplication of data entry, facilities will be available for selecting |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
38 |
an existing Role associated with a particular User to be duplicated for |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
39 |
participation in a new Program. |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
40 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
41 |
A Person has to have at least one Role in order to be able to create |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
42 |
any Work (such as a Document) on the site. The easiest-to-obtain Role is |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
43 |
probably Club Member (though Clubs can set their own membership criteria). |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
44 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
45 |
A Role entity participates in the following relationships implemented |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
46 |
as a db.ReferenceProperty elsewhere in another db.Model: |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
47 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
48 |
documentation) a 1:many relationship of Documentation (tax forms, |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
49 |
letters from schools, etc.) associated with the Role by Hosts. This |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
50 |
relation is implemented as the 'documentation' back-reference Query of |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
51 |
the Documentation model 'role' reference. |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
52 |
|
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
53 |
works) a many:many relationship with Works, stored in a separate |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
54 |
WorksRoles model, representing the Work authored by this Role. |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
55 |
See the WorksRoles model class for details. |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
56 |
""" |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
57 |
pass |
8ecc2e4198cd
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
58 |