app/soc/models/contributor.py
author Todd Larsen <tlarsen@google.com>
Mon, 29 Sep 2008 15:31:50 +0000
changeset 206 832335761384
parent 181 fdd29818a954
child 207 8ecc2e4198cd
permissions -rw-r--r--
Make use of PolyModel for Works, Documents, etc. Add some (but not all) of the missing Models related to Documents. Refactor site settings to be useful for any "/home" page view. Make the resulting home settings store a reference to the Document, rather than looking up the Document by a hard-code key name. This is to set the stage for Document editing being generic, and then being able to select from some existing documents which one to use as the "/home" static content. This makes it possible to pre-edit several Documents, have them Reviewed, and then quickly change the "/home" page content as a setting, rather than editing the Document in the settings form (though settings forms might still embed the current document into their form for convenience). Patch by: Todd Larsen Review by: Pawel Solyga Review URL: http://codereviews.googleopensourceprograms.com/1001
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
# 
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
# 
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
"""This module contains the Contributor Model."""
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
__authors__ = [
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
  '"Todd Larsen" <tlarsen@google.com>',
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
]
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
from google.appengine.ext import db
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
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
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
    28
import soc.models.person
14
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
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
    31
class Contributor(base.ModelWithFieldAttributes):
14
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
  """Contributor details for a specific Program.
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
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
    34
  Some Contributor workflows have the Contributor (acting as an author)
14
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
  creating Proposals and desiring for one (or more?) of them to be
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
  converted into Tasks by Reviewers and Hosts.  Other workflows have the
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
    37
  Reviewers (acting as an author) proposing Proposals, that Contributors
14
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
  claim to convert them into Tasks.
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
  A Contributor entity participates in the following relationships implemented 
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
  as a db.ReferenceProperty elsewhere in another db.Model:
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
   tasks)  a many:many relationship associating all of the Tasks to which
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
     a specific Contributor has contributed with that Contributor.  See
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
     the TasksContributors model for details.
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
  """
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
  
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
  #: a 1:1 relationship associating a Contributor with generic Author
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
  #: details and capabilities. The back-reference in the Author
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
  #: model is a Query named 'contributor'.
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
    51
  person = db.ReferenceProperty(reference_class=models.person.Person, 
14
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
                                required=True, 
aec6d7b8e745 Initial implementation of the Contributor Model in the contributor.py module.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
                                collection_name="contributor")