app/soc/models/group.py
author Sverre Rabbelier <srabbelier@gmail.com>
Mon, 16 Mar 2009 23:51:20 +0000
changeset 1899 c841800f3727
parent 1877 93dfd2d40c0b
child 1961 85a57ba6f6fa
permissions -rw-r--r--
Added format and containsAll to the dicts module Patch by: Sverre Rabbelier
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,
1877
93dfd2d40c0b Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1562
diff changeset
    66
      verbose_name=ugettext('Email'))
93dfd2d40c0b Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1562
diff changeset
    67
  email.help_text = ugettext(
93dfd2d40c0b Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1562
diff changeset
    68
      "Enter an email address to be used by would-be members seeking "
93dfd2d40c0b Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1562
diff changeset
    69
      "additional information. This can be an individual's email address or a "
93dfd2d40c0b Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1562
diff changeset
    70
      "mailing list address; use whichever will work best for you.")
1562
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1308
diff changeset
    71
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
    72
  #: 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
    73
  description = db.TextProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    74
      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
    75
772
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    76
  #: 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
    77
  pub_mailing_list = db.StringProperty(required=False,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    78
    verbose_name=ugettext('Public Mailing List'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    79
  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
    80
    '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
    81
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    82
  #: 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
    83
  irc_channel = db.StringProperty(required=False,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    84
    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
    85
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    86
  #====================================================================
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    87
  # (private) contact information
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    88
  #====================================================================
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    89
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
    90
  #: 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
    91
  #: 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
    92
  #: 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
    93
  contact_street = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
    94
      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
    95
  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
    96
      '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
    97
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
    98
  #: 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
    99
  #: 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
   100
  #: 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
   101
  contact_city = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   102
      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
   103
  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
   104
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   105
  #: 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
   106
  #: 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
   107
  #: 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
   108
  contact_state = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   109
      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
   110
  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
   111
      '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
   112
      '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
   113
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
   114
  #: 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
   115
  contact_country = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   116
      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
   117
      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
   118
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
   119
  #: 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
   120
  #: 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
   121
  #: 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
   122
  contact_postalcode = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   123
      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
   124
  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
   125
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
   126
  #: 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
   127
  #: 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
   128
  phone = db.PhoneNumberProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   129
      verbose_name=ugettext('Phone Number'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 834
diff changeset
   130
  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
   131
      '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
   132
1060
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   133
  #====================================================================
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   134
  # (private) shipping information
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   135
  #====================================================================
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   136
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   137
  #: 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
   138
  #: 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
   139
  #: 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
   140
  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
   141
      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
   142
  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
   143
      '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
   144
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   145
  #: 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
   146
  #: 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
   147
  #: 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
   148
  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
   149
      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
   150
  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
   151
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   152
  #: 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
   153
  #: 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
   154
  #: 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
   155
  shipping_state = db.StringProperty(
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   156
      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
   157
  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
   158
      '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
   159
      'lower ASCII characters only')
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   160
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   161
  #: 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
   162
  #: 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
   163
  #: 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
   164
  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
   165
      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
   166
  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
   167
eb6231138307 Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
   168
  #: 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
   169
  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
   170
      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
   171
      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
   172
1085
0afbdd0905ef Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1060
diff changeset
   173
  #: 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
   174
  #: 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
   175
  #: 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
   176
  #: 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
   177
  #: 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
   178
  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
   179
      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
   180