app/soc/models/organization.py
author Todd Larsen <tlarsen@google.com>
Sat, 15 Nov 2008 03:12:33 +0000
changeset 481 94834a1e6c01
parent 385 6d410bf49a82
child 682 187f4d95fedb
permissions -rw-r--r--
Attempt to rename User.id to User.account, in preparation for making User be derived from Linkable, which will have a property named 'id'. Patch by: Todd Larsen
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
#
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
     3
# Copyright 2008 the Melange 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
     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
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
    17
"""This module contains the Organization 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
    18
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
__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
    20
  '"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
    21
]
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
316
9efdc7bc3565 Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 244
diff changeset
    23
369
2955eff2bf94 Replace GROUP_TYPE_PLURAL and GROUP_TYPE_SHORT constants in Group models with more generic TYPE_NAME, TYPE_NAME_SHORT, TYPE_NAME_PLURAL names and apply changes in affected files. Use ugettext_lazy for TYPE_NAME and TYPE_NAME_PLURAL constants. This approach is similar to the upcoming refactor of views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 344
diff changeset
    24
from django.utils.translation import ugettext_lazy
2955eff2bf94 Replace GROUP_TYPE_PLURAL and GROUP_TYPE_SHORT constants in Group models with more generic TYPE_NAME, TYPE_NAME_SHORT, TYPE_NAME_PLURAL names and apply changes in affected files. Use ugettext_lazy for TYPE_NAME and TYPE_NAME_PLURAL constants. This approach is similar to the upcoming refactor of views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 344
diff changeset
    25
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
    26
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
    27
316
9efdc7bc3565 Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 244
diff changeset
    28
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    29
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
    30
  """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
    31
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
    32
  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
    33
  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
    34
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    35
   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
    36
     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
    37
     '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
    38
     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
    39
  """
344
d135c8c09967 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.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 316
diff changeset
    40
369
2955eff2bf94 Replace GROUP_TYPE_PLURAL and GROUP_TYPE_SHORT constants in Group models with more generic TYPE_NAME, TYPE_NAME_SHORT, TYPE_NAME_PLURAL names and apply changes in affected files. Use ugettext_lazy for TYPE_NAME and TYPE_NAME_PLURAL constants. This approach is similar to the upcoming refactor of views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 344
diff changeset
    41
  #: Type name used in templates
2955eff2bf94 Replace GROUP_TYPE_PLURAL and GROUP_TYPE_SHORT constants in Group models with more generic TYPE_NAME, TYPE_NAME_SHORT, TYPE_NAME_PLURAL names and apply changes in affected files. Use ugettext_lazy for TYPE_NAME and TYPE_NAME_PLURAL constants. This approach is similar to the upcoming refactor of views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 344
diff changeset
    42
  TYPE_NAME = ugettext_lazy('Organization')
2955eff2bf94 Replace GROUP_TYPE_PLURAL and GROUP_TYPE_SHORT constants in Group models with more generic TYPE_NAME, TYPE_NAME_SHORT, TYPE_NAME_PLURAL names and apply changes in affected files. Use ugettext_lazy for TYPE_NAME and TYPE_NAME_PLURAL constants. This approach is similar to the upcoming refactor of views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 344
diff changeset
    43
  #: Type short name used for example in urls
2955eff2bf94 Replace GROUP_TYPE_PLURAL and GROUP_TYPE_SHORT constants in Group models with more generic TYPE_NAME, TYPE_NAME_SHORT, TYPE_NAME_PLURAL names and apply changes in affected files. Use ugettext_lazy for TYPE_NAME and TYPE_NAME_PLURAL constants. This approach is similar to the upcoming refactor of views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 344
diff changeset
    44
  TYPE_NAME_SHORT = 'org'
2955eff2bf94 Replace GROUP_TYPE_PLURAL and GROUP_TYPE_SHORT constants in Group models with more generic TYPE_NAME, TYPE_NAME_SHORT, TYPE_NAME_PLURAL names and apply changes in affected files. Use ugettext_lazy for TYPE_NAME and TYPE_NAME_PLURAL constants. This approach is similar to the upcoming refactor of views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 344
diff changeset
    45
  #: Type plural name used in templates
2955eff2bf94 Replace GROUP_TYPE_PLURAL and GROUP_TYPE_SHORT constants in Group models with more generic TYPE_NAME, TYPE_NAME_SHORT, TYPE_NAME_PLURAL names and apply changes in affected files. Use ugettext_lazy for TYPE_NAME and TYPE_NAME_PLURAL constants. This approach is similar to the upcoming refactor of views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 344
diff changeset
    46
  TYPE_NAME_PLURAL = ugettext_lazy('Organizations')