author | Sverre Rabbelier <srabbelier@gmail.com> |
Thu, 13 Nov 2008 16:40:05 +0000 | |
changeset 477 | 8a8b1bd035c4 |
parent 385 | 6d410bf49a82 |
child 970 | 8b5611d5b053 |
permissions | -rw-r--r-- |
97
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
2 |
# |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
4 |
# |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
8 |
# |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
10 |
# |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
16 |
|
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
17 |
"""This module contains the Proposal Model.""" |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
18 |
|
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
19 |
__authors__ = [ |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
20 |
'"Todd Larsen" <tlarsen@google.com>', |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
21 |
'"Pawel Solyga" <pawel.solyga@gmail.com>', |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
22 |
] |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@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 |
|
97
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
25 |
from google.appengine.ext import db |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
26 |
|
385
6d410bf49a82
Remove not used imports in models. Fix missing spaces in models when operator not preceded by a space. Add missing ugettext_lazy import to Proposal model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
351
diff
changeset
|
27 |
from django.utils.translation import ugettext_lazy |
6d410bf49a82
Remove not used imports in models. Fix missing spaces in models when operator not preceded by a space. Add missing ugettext_lazy import to Proposal model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
351
diff
changeset
|
28 |
|
351
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
29 |
import soc.models.work |
342
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
30 |
import soc.models.quiz |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
31 |
import soc.models.response |
97
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
32 |
|
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
|
33 |
|
351
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
34 |
class Proposal(soc.models.work.Work): |
97
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
35 |
"""Model of a Proposal, which is a specific form of a Work. |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
36 |
|
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
|
37 |
The specific way that the 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
|
38 |
are used with a Proposal 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
|
39 |
|
351
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
40 |
work.title: the title of the Proposal |
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
|
41 |
|
351
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
42 |
work.reviews: reviews of the Proposal by Reviewers |
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
|
43 |
|
351
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
44 |
work.content: the details of the Proposal; which, unlike work.abstract |
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
45 |
is considered "public" information, the contents of a Proposal are only |
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
46 |
displayed to Persons in Roles that have a "need to know" those details. |
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
|
47 |
|
97
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
48 |
A Proposal entity participates in the following relationships implemented |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
49 |
as a db.ReferenceProperty elsewhere in another db.Model: |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
50 |
|
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
51 |
tasks) an optional 1:many relationship of Task entities using the |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
52 |
Proposal as their foundation. This relation is implemented as the |
d01d0ae7d6c8
Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
53 |
'tasks' back-reference Query of the Task model 'proposal' reference. |
129
d9543d181c37
Bugfix, invalid syntax noticed by epydoc.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
97
diff
changeset
|
54 |
""" |
351
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
55 |
#: optional, indexed plain text field used for different purposes, |
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
56 |
#: depending on the specific type of the work |
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
57 |
abstract = db.StringProperty(multiline=True) |
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
58 |
abstract.help_text = ugettext_lazy( |
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
59 |
'short abstract, summary, or snippet;' |
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
60 |
' 500 characters or less, plain text displayed publicly') |
b37fc4c1e189
Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents:
342
diff
changeset
|
61 |
|
342
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
62 |
#: an optional many:1 relationship between Proposal and a Quiz that |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
63 |
#: defines what Questions were added by the prospective Proposal Reviewer |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
64 |
#: for the Proposal author to answer. |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
65 |
quiz = db.ReferenceProperty(reference_class=soc.models.quiz.Quiz, |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
66 |
required=False, collection_name="proposals") |
129
d9543d181c37
Bugfix, invalid syntax noticed by epydoc.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
97
diff
changeset
|
67 |
|
342
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
68 |
#: an optional 1:1 relationship where a Proposal author's Answers to |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
69 |
#: a Quiz attached to the Proposal template by the Proposal Reviewer |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
70 |
#; are collected. |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
71 |
response = db.ReferenceProperty( |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
72 |
reference_class=soc.models.response.Response, required=False, |
72482d8e5b34
Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents:
206
diff
changeset
|
73 |
collection_name="proposal") |