app/soc/models/task.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Tue, 14 Oct 2008 16:10:07 +0000
changeset 324 05e21c089be6
parent 316 9efdc7bc3565
child 385 6d410bf49a82
permissions -rw-r--r--
Add missing import in soc/views/site/sponsor/list.py which caused exception when app was deployed and first site you visited was "List Site Sponsors". Update files according to recent django update and django backwards incompatibility (for example newforms is changed to forms). Patch by: Pawel Solyga Review by: to-be-reviewed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
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
    27
from soc.models import base
316
9efdc7bc3565 Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 181
diff changeset
    28
18
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
import soc.models.proposal
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
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
    32
class Task(base.ModelWithFieldAttributes):
18
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
  """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
    34
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
  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
    36
  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
    37
  the original Proposal.
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
  A Task entity participates in the following relationships implemented
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
  as a db.ReferenceProperty elsewhere in another db.Model:
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
   contributors)  a required many:many relationship associating all of
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
     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
    44
     TasksContributors model for details.
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
  """
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
 
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
  #: 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
    48
  #: 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
    49
  #: 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
    50
  #: 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
    51
  proposal = db.ReferenceProperty(reference_class=models.proposal.Proposal,
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
                                  required=True,
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
    53
                                  collection_name="tasks")
18
2e9454e4924e Initial definition of the Work Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54