app/soc/models/organization.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 19 Feb 2009 22:51:24 +0000
changeset 1407 423425ac79f5
parent 1322 5153bd89147f
child 1408 2d91128c3685
permissions -rw-r--r--
Fixed copy/paste fail Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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:
diff changeset
     1
#!/usr/bin/python2.5
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     2
#
1308
35b75ffcbb37 Partially reverted "Update the copyright notice for 2009."
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
     3
# Copyright 2008 the Melange authors.
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:
diff changeset
     4
#
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     8
# 
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    10
# 
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    16
775
d18d286df40f Fixed missing import in soc/models/organization.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 773
diff changeset
    17
"""This module contains the Organization Model.
d18d286df40f Fixed missing import in soc/models/organization.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 773
diff changeset
    18
"""
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:
diff changeset
    19
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    20
__authors__ = [
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    21
  '"Pawel Solyga" <pawel.solyga@gmail.com>',
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    22
]
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    23
316
9efdc7bc3565 Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 244
diff changeset
    24
775
d18d286df40f Fixed missing import in soc/models/organization.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 773
diff changeset
    25
from google.appengine.ext import db
d18d286df40f Fixed missing import in soc/models/organization.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 773
diff changeset
    26
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 883
diff changeset
    27
from django.utils.translation import ugettext
775
d18d286df40f Fixed missing import in soc/models/organization.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 773
diff changeset
    28
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:
diff changeset
    29
import soc.models.group
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    30
316
9efdc7bc3565 Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 244
diff changeset
    31
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    32
class Organization(soc.models.group.Group):
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:
diff changeset
    33
  """Organization details.
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    34
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    35
  A Organization entity participates in the following relationships implemented 
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    36
  as a db.ReferenceProperty elsewhere in another db.Model:
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    37
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    38
   reviewers)  a many:1 relationship associating Reviewers with
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:
diff changeset
    39
     a specific Organization. This relation is implemented as the
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    40
     'reviewers' back-reference Query of the Organization model 'org'
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    41
     reference.
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:
diff changeset
    42
  """
1322
5153bd89147f Add an idea list (url) property to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    43
772
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 748
diff changeset
    44
  #: Optional development mailing list.     
773
fefaf4628a4d Mailing list EmailProperty should be StringProperty instead, so that it is
Todd Larsen <tlarsen@google.com>
parents: 772
diff changeset
    45
  dev_mailing_list = db.StringProperty(required=False,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 883
diff changeset
    46
    verbose_name=ugettext('Development Mailing List'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 883
diff changeset
    47
  dev_mailing_list.help_text = ugettext(
772
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 748
diff changeset
    48
    'Mailing list email address, URL to sign-up page, etc.')
1322
5153bd89147f Add an idea list (url) property to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    49
834
b60c9ccbeaa5 Move member_template property from Group to Organization model since it's Organization specific property.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 775
diff changeset
    50
  member_template = db.ReferenceProperty(
b60c9ccbeaa5 Move member_template property from Group to Organization model since it's Organization specific property.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 775
diff changeset
    51
    reference_class=soc.models.document.Document, required=False,
883
1e0af43577ee Changed the collection name and help text for Organization member template.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 834
diff changeset
    52
    collection_name='org_app_member_template',
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 883
diff changeset
    53
    verbose_name=ugettext('Application template'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 883
diff changeset
    54
  member_template.help_text = ugettext(
834
b60c9ccbeaa5 Move member_template property from Group to Organization model since it's Organization specific property.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 775
diff changeset
    55
    'This template will be presented to potential members when they'
883
1e0af43577ee Changed the collection name and help text for Organization member template.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 834
diff changeset
    56
    ' apply to the organization.')
772
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 748
diff changeset
    57
1322
5153bd89147f Add an idea list (url) property to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    58
  ideas = db.LinkProperty(required=False, verbose_name=ugettext('Idea list'))
5153bd89147f Add an idea list (url) property to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    59
  ideas.help_text = ugettext(
5153bd89147f Add an idea list (url) property to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    60
      'The URL to the ideas list of your organization.')
5153bd89147f Add an idea list (url) property to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    61
  ideas.example_text = ugettext('For instance a link to a Melange public '
5153bd89147f Add an idea list (url) property to organization
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
    62
      'document or some other URL')