app/soc/models/group.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Wed, 04 Mar 2009 17:29:35 +0000
changeset 1628 276e8e72c874
parent 1562 0e1a93e0c54d
child 1877 93dfd2d40c0b
permissions -rw-r--r--
Fix too long lines in soc.models.org_app module. Patch by: Pawel Solyga 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
#
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.
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
     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>',
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    21
  '"Lennard de Rijk" <ljvderijk@gmail.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
    22
  '"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
    23
]
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
    24
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    25
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
    26
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
    27
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    28
from django.utils.translation import ugettext
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
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
    30
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
    31
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
    32
import soc.models.presence
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
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
    36
class Group(soc.models.presence.Presence):
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,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    42
      verbose_name=ugettext('Name'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    43
  name.help_text = ugettext('Complete, formal name of the 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
  
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
  #: 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
    46
  #: 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
    47
  short_name = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    48
      verbose_name=ugettext('Short name'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    49
  short_name.help_text = ugettext('Short name used for sidebar menu')
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
    50
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
    51
  #: 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
    52
  #: 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
    53
  #: 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
    54
  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
    55
                                 required=True, collection_name="groups",
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    56
                                 verbose_name=ugettext('Founded by'))
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
    57
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
    58
  #: 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
    59
  home_page = db.LinkProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    60
      verbose_name=ugettext('Home Page URL'))
1562
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1308
diff changeset
    61
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
    62
  #: 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
    63
  #: 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
    64
  #: 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
    65
  email = db.EmailProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    66
      verbose_name=ugettext('Email'))  
1562
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1308
diff changeset
    67
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
    68
  #: 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
    69
  description = db.TextProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    70
      verbose_name=ugettext('Description'))
1562
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1308
diff changeset
    71
772
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    72
  #: Optional public mailing list.     
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    73
  pub_mailing_list = db.StringProperty(required=False,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    74
    verbose_name=ugettext('Public Mailing List'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    75
  pub_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: 685
diff changeset
    76
    'Mailing list email address, URL to sign-up page, etc.')
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    77
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    78
  #: Optional public IRC channel.
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    79
  irc_channel = db.StringProperty(required=False,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    80
    verbose_name=ugettext('Public IRC Channel (and Network)'))
772
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    81
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    82
  #====================================================================
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    83
  # (private) contact information
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    84
  #====================================================================
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    85
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
    86
  #: 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
    87
  #: Group street address can only be lower ASCII, not UTF-8 text, 
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    88
  #: because, if supplied, it might be used as a shipping address.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    89
  contact_street = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    90
      verbose_name=ugettext('Street address'))
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    91
  contact_street.help_text = ugettext(
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
      '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
    93
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
    94
  #: 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
    95
  #: City can only be lower ASCII, not UTF-8 text, because, if
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    96
  #: supplied, it might be used as a shipping address.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    97
  contact_city = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    98
      verbose_name=ugettext('City'))
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    99
  contact_city.help_text = ugettext('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
   100
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   101
  #: 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
   102
  #: Group state/province can only be lower ASCII, not UTF-8
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   103
  #: text, because, if supplied, it might be used as a shipping address.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   104
  contact_state = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   105
      verbose_name=ugettext('State/Province'))
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   106
  contact_state.help_text = ugettext(
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
   107
      '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
   108
      '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
   109
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
   110
  #: Required field containing address country or territory of the group.
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   111
  contact_country = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   112
      verbose_name=ugettext('Country/Territory'),
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
      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
   114
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
   115
  #: Required field containing address postal code of the group (ZIP code in
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   116
  #: the United States).Postal code can only be lower ASCII, not UTF-8 
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   117
  #: text, because, if supplied, it might be used as a shipping address.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   118
  contact_postalcode = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   119
      verbose_name=ugettext('ZIP/Postal Code'))
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   120
  contact_postalcode.help_text = ugettext('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
   121
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
   122
  #: 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
   123
  #: 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
   124
  phone = db.PhoneNumberProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   125
      verbose_name=ugettext('Phone Number'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   126
  phone.help_text = ugettext(
208
e076aee6e90f Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
   127
      'include complete international calling number with country code')
789
e55cad180973 Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents: 772
diff changeset
   128
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   129
  #====================================================================
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   130
  # (private) shipping information
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   131
  #====================================================================
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   132
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   133
  #: Optional field containing a group street address.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   134
  #: Group street address can only be lower ASCII, not UTF-8 text, 
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   135
  #: because, if supplied, it is used as a shipping address.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   136
  shipping_street = db.StringProperty(required=False,
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   137
      verbose_name=ugettext('Shipping Street address'))
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   138
  shipping_street.help_text = ugettext(
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   139
      'street number and name, lower ASCII characters only')
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   140
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   141
  #: Optional field containing group address city.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   142
  #: City can only be lower ASCII, not UTF-8 text, because, if
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   143
  #: supplied, it is used as a shipping address.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   144
  shipping_city = db.StringProperty(required=False,
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   145
      verbose_name=ugettext('Shipping City'))
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   146
  shipping_city.help_text = ugettext('lower ASCII characters only')
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   147
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   148
  #: Optional field containing group address state or province.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   149
  #: Group state/province can only be lower ASCII, not UTF-8
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   150
  #: text, because, if supplied, it is used as a shipping address.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   151
  shipping_state = db.StringProperty(
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   152
      verbose_name=ugettext('Shipping State/Province'))
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   153
  shipping_state.help_text = ugettext(
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   154
      'optional if country/territory does not have states or provinces, '
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   155
      'lower ASCII characters only')
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   156
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   157
  #: Optional field containing address postal code of the group (ZIP code in
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   158
  #: the United States). Postal code can only be lower ASCII, not UTF-8 
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   159
  #: text, because, if supplied, it is used as a shipping address.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   160
  shipping_postalcode = db.StringProperty(required=False,
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   161
      verbose_name=ugettext('Shipping ZIP/Postal Code'))
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   162
  shipping_postalcode.help_text = ugettext('lower ASCII characters only')
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   163
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   164
  #: Optional field containing address country or territory of the group.
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   165
  shipping_country = db.StringProperty(required=False,
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   166
      verbose_name=ugettext('Shipping Country/Territory'),
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   167
      choices=countries.COUNTRIES_AND_TERRITORIES)
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   168
1085
0afbdd0905ef Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1060
diff changeset
   169
  #: Required property showing the current status of the group
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   170
  #: new: the group has not been active yet
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   171
  #: active: the group is active
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   172
  #: inactive: used to mark a group as read-only
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   173
  #: invalid: the group has been marked as removed
1085
0afbdd0905ef Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1060
diff changeset
   174
  status = db.StringProperty(required=True, default='new',
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   175
      choices=['new', 'active', 'inactive', 'invalid'])
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   176