author | Todd Larsen <tlarsen@google.com> |
Thu, 18 Sep 2008 17:31:01 +0000 | |
changeset 161 | f4af04306890 |
parent 54 | 03e267d67478 |
child 181 | fdd29818a954 |
permissions | -rw-r--r-- |
18
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
2 |
# |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
4 |
# |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
8 |
# |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
10 |
# |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
16 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
17 |
"""This module contains the Task Model.""" |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
18 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
19 |
__authors__ = [ |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
20 |
'"Todd Larsen" <tlarsen@google.com>', |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
22 |
] |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
23 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
24 |
from google.appengine.ext import db |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
25 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
26 |
from soc import models |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
27 |
import soc.models.proposal |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
28 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
29 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
30 |
class Task(db.Model): |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
31 |
"""Model of a Task, which is a Proposal to be completed by Contributors. |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
32 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
33 |
A Task brings along a Proposal that was used to initiate the Task. A Task |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
34 |
may have a unique collection of Reviews, in addition to those attached to |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
35 |
the original Proposal. |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
36 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
37 |
A Task entity participates in the following relationships implemented |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
38 |
as a db.ReferenceProperty elsewhere in another db.Model: |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
39 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
40 |
contributors) a required many:many relationship associating all of |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
41 |
the Contributors to a Task to the specific Task. See the |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
42 |
TasksContributors model for details. |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
43 |
""" |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
44 |
|
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
45 |
#: A required many:1 relationship with the Proposal on which the |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
46 |
#: Task is based. A Task may be based on only a single Proposal, |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
47 |
#: but a Proposal can be the foundation for multiple Tasks. The |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
48 |
#: back-reference in the Proposal model is a Query named 'tasks'. |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
49 |
proposal = db.ReferenceProperty(reference_class=models.proposal.Proposal, |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
50 |
required=True, |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
51 |
collection_name="tasks") |
2e9454e4924e
Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
52 |