app/soc/models/group.py
author Todd Larsen <tlarsen@google.com>
Sat, 15 Nov 2008 03:12:33 +0000
changeset 481 94834a1e6c01
parent 410 2af7f84f4fc7
child 512 aae25d2b4464
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:
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     2
#
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
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: 174
diff changeset
     8
# 
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
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: 174
diff changeset
    10
# 
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    17
"""This module contains the Group Model."""
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    18
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    19
__authors__ = [
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
  '"Todd Larsen" <tlarsen@google.com>',
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: 174
diff changeset
    21
  '"Pawel Solyga" <pawel.solyga@gmail.com>',
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    22
]
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    23
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    24
322
6641e941ef1e Fixed imports sorting based on comments for r751.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 316
diff changeset
    25
import polymodel
6641e941ef1e Fixed imports sorting based on comments for r751.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 316
diff changeset
    26
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    27
from google.appengine.ext import db
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    28
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    29
from django.utils.translation import ugettext_lazy
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.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: 174
diff changeset
    31
from soc.models import countries
316
9efdc7bc3565 Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 298
diff changeset
    32
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    33
import soc.models.user
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    34
316
9efdc7bc3565 Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 298
diff changeset
    35
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    36
class Group(polymodel.PolyModel):
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    37
  """Common data fields for all groups.
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    38
  """
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    39
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: 174
diff changeset
    40
  #: Required field storing name of the 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: 174
diff changeset
    41
  name = db.StringProperty(required=True,
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    42
      verbose_name=ugettext_lazy('Name'))
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    43
  name.help_text = ugettext_lazy('Complete, formal name of the 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: 174
diff changeset
    44
  
298
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents: 259
diff changeset
    45
  #: Required field storing link_name used in URLs to identify 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: 174
diff changeset
    46
  #: Lower ASCII characters only.
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    47
  link_name = db.StringProperty(required=True,
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    48
      verbose_name=ugettext_lazy('Link name'))
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    49
  link_name.help_text = ugettext_lazy(
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    50
      'Field used in URLs to identify 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: 174
diff changeset
    51
      'Lower ASCII characters only.')
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    52
  
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    53
  #: Required field storing short name of the 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: 174
diff changeset
    54
  #: It can be used for displaying group as sidebar menu item.
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    55
  short_name = db.StringProperty(required=True,
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    56
      verbose_name=ugettext_lazy('Short name'))
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    57
  short_name.help_text = ugettext_lazy('Short name used for sidebar menu')
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    58
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    59
  #: Required many:1 relationship indicating the founding User of the
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    60
  #: Group (this relationship is needed to keep track of lifetime group
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    61
  #: creation limits, used to prevent spamming, etc.).
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    62
  founder = db.ReferenceProperty(reference_class=soc.models.user.User,
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
    63
                                 required=True, collection_name="groups",
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: 333
diff changeset
    64
                                 verbose_name=ugettext_lazy('Founded by'))
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: 333
diff changeset
    65
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
    66
  #: Required field storing a home page URL of the group.
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
    67
  home_page = db.LinkProperty(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: 174
diff changeset
    68
      verbose_name=ugettext_lazy('Home Page URL'))
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    69
  
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
    70
  #: Required email address used as the "public" contact mechanism for
481
94834a1e6c01 Attempt to rename User.id to User.account, in preparation for making User be
Todd Larsen <tlarsen@google.com>
parents: 410
diff changeset
    71
  #: the Group (as opposed to the founder.account email address which is
94834a1e6c01 Attempt to rename User.id to User.account, in preparation for making User be
Todd Larsen <tlarsen@google.com>
parents: 410
diff changeset
    72
  #: kept secret, revealed only to Developers).
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
    73
  email = db.EmailProperty(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: 174
diff changeset
    74
      verbose_name=ugettext_lazy('Email'))  
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    75
  
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
    76
  #: Required field storing description of the group.
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
    77
  description = db.TextProperty(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: 174
diff changeset
    78
      verbose_name=ugettext_lazy('Description'))
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    79
      
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
    80
  #: Required field containing a group street address.
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: 174
diff changeset
    81
  #: Group street address can only be lower ASCII, not UTF-8 text, 
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    82
  #: because, if supplied, it is used as a shipping address.
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
    83
  street = db.StringProperty(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: 174
diff changeset
    84
      verbose_name=ugettext_lazy('Street address'))
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    85
  street.help_text = ugettext_lazy(
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    86
      'street number and name, lower ASCII characters only')
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    87
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
    88
  #: Required field containing group address city.
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: 174
diff changeset
    89
  #: City can only be lower ASCII, not UTF-8 text, because, if
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    90
  #: supplied, it is used as a shipping address.
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
    91
  city = db.StringProperty(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: 174
diff changeset
    92
      verbose_name=ugettext_lazy('City'))
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
    93
  city.help_text = ugettext_lazy('lower ASCII characters only')
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    94
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
    95
  #: Required field containing group address state or province.
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: 174
diff changeset
    96
  #: Group state/province can only be lower ASCII, not UTF-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: 174
diff changeset
    97
  #: text, because, if supplied, it is used as a shipping address.
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
    98
  state = db.StringProperty(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: 174
diff changeset
    99
      verbose_name=ugettext_lazy('State/Province'))
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
   100
  state.help_text = ugettext_lazy(
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
   101
      'optional if country/territory does not have states or provinces, '
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
   102
      'lower ASCII characters only')
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
   103
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
   104
  #: Required field containing address country or territory of the group.
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
   105
  country = db.StringProperty(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: 174
diff changeset
   106
      verbose_name=ugettext_lazy('Country/Territory'),
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
   107
      choices=countries.COUNTRIES_AND_TERRITORIES)
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   108
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
   109
  #: Required field containing address postal code of the group (ZIP code in
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: 174
diff changeset
   110
  #: the United States). Postal code can only be lower ASCII, not UTF-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: 174
diff changeset
   111
  #: text, because, if supplied, it is used as a shipping address.
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
   112
  postalcode = db.StringProperty(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: 174
diff changeset
   113
      verbose_name=ugettext_lazy('ZIP/Postal Code'))
385
6d410bf49a82 Remove not used imports in models. Fix missing spaces in models when operator not preceded by a space. Add missing ugettext_lazy import to Proposal model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 363
diff changeset
   114
  postalcode.help_text = ugettext_lazy('lower ASCII characters only')
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: 174
diff changeset
   115
333
d3e85f6144cc Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 322
diff changeset
   116
  #: Required contact phone number that will be, amongst other uses,
174
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   117
  #: supplied to shippers along with the shipping address; kept private.
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
   118
  phone = db.PhoneNumberProperty(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: 174
diff changeset
   119
      verbose_name=ugettext_lazy('Phone Number'))
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
   120
  phone.help_text = ugettext_lazy(
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
   121
      'include complete international calling number with country code')