app/soc/models/proposal.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Wed, 15 Oct 2008 20:24:02 +0000
changeset 344 d135c8c09967
parent 342 72482d8e5b34
child 351 b37fc4c1e189
permissions -rw-r--r--
Change verbose_name of founder property in Group model from "Created by" to "Founded by". Add GROUP_TYPE_SHORT and GROUP_TYPE_PLURAL for all models that inherit from Group and use that values in templates and contexts. Assume that group_type, group_type_short and group_type_plural are defined in context and remove not needed ifs in templates. Rename "Linkname" to "Link name" in list/group_heading.html template. Patch by: Pawel Solyga Review by: to-be-reviewed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
342
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
diff changeset
    27
import soc.models.document
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
diff changeset
    28
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
    29
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
    30
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
    31
342
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
diff changeset
    32
class Proposal(soc.models.document.Document):
97
d01d0ae7d6c8 Moved Proposal model from wiki to source code and updated ProposalModel wiki page.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    33
  """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
    34
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
    35
  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
    36
  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
    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
  work.title:  the title of the Proposal
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
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
  work.abstract:  publicly displayed as a proposal abstract or summary
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
342
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
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
342
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
diff changeset
    44
  document.content:  the details of the Proposal; which, unlike work.abstract
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
diff changeset
    45
    is considered "public" information, the contents of a Proposal are only
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
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
  """
342
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
diff changeset
    55
  #: 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
    56
  #: 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
    57
  #: 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
    58
  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
    59
                              required=False, collection_name="proposals")
129
d9543d181c37 Bugfix, invalid syntax noticed by epydoc.
Sverre Rabbelier <srabbelier@gmail.com>
parents: 97
diff changeset
    60
342
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
diff changeset
    61
  #: 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
    62
  #: 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
    63
  #; are collected. 
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
diff changeset
    64
  response = db.ReferenceProperty(
72482d8e5b34 Remove the proposed WorksAuthors many:many relation and promote the "founder"
Todd Larsen <tlarsen@google.com>
parents: 206
diff changeset
    65
      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
    66
      collection_name="proposal")