app/soc/models/group.py
author Sverre Rabbelier <srabbelier@gmail.com>
Sun, 12 Oct 2008 00:08:54 +0000
changeset 298 c76a366c7ab4
parent 259 74eb6b01c82c
child 316 9efdc7bc3565
permissions -rw-r--r--
Replace almost all occurences of linkname with link_name In an attempt to have some atomicness in these commits this patch does a rename for the sake of consistency. Not all were changed, but the next commit will address that. Patch by: Sverre Rabbelier Reviewed by: to-be-reviewed
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
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
    25
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
    26
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    27
import polymodel
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    28
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
    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
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
    32
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
    33
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    34
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
    35
  """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
    36
  """
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
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
    38
  #: 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
    39
  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
    40
      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
    41
  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
    42
  
298
c76a366c7ab4 Replace almost all occurences of linkname with link_name
Sverre Rabbelier <srabbelier@gmail.com>
parents: 259
diff changeset
    43
  #: 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
    44
  #: 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
    45
  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
    46
      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
    47
  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
    48
      '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
    49
      '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
    50
  
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
  #: 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
    52
  #: 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
    53
  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
    54
      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
    55
  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
    56
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
    57
  #: 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
    58
  #: 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
    59
  #: 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
    60
  founder = db.ReferenceProperty(reference_class=soc.models.user.User,
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
    61
                                 required=True, collection_name="groups")  
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
    62
  #: Optional 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
    63
  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
    64
      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
    65
  
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
    66
  #: Optional email address used as the "public" contact mechanism for
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
    67
  #: the Group (as opposed to the founder.id email address which is kept
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
    68
  #: 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
    69
  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
    70
      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
    71
  
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
    72
  #: Optional 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
    73
  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
    74
      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
    75
      
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
    76
  #: Optional field containing a group 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
    77
  #: 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
    78
  #: 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
    79
  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
    80
      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
    81
  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
    82
      '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
    83
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
  #: Optional field containing group address 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
    85
  #: 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
    86
  #: 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
    87
  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
    88
      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
    89
  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
    90
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
    91
  #: Optional field containing group address state or 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
    92
  #: 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
    93
  #: 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
    94
  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
    95
      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
    96
  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
    97
      '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
    98
      '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
    99
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
  #: Optional 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
   101
  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
   102
      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
   103
      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
   104
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
   105
  #: Optional field containing address postal code of the group (ZIP code in
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
  #: 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
   107
  #: 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
   108
  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
   109
      verbose_name=ugettext_lazy('ZIP/Postal Code'))
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
  postalcode.help_text=ugettext_lazy('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
   111
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
   112
  #: Optional 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
   113
  #: 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
   114
  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
   115
      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
   116
  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
   117
      'include complete international calling number with country code')