app/soc/models/group.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 08 Jan 2009 21:23:52 +0000
changeset 789 e55cad180973
parent 772 a91f7856754e
child 834 b60c9ccbeaa5
permissions -rw-r--r--
Moved the member_template field to app and removed 'optional' Also shortened the verbose_name of the member_template field. 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
#
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
f065ee52d759 A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    27
from 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
    28
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
    29
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
    30
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
    31
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
    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
316
9efdc7bc3565 Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 298
diff changeset
    34
534
c31cfbf1a20f Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
    35
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
    36
  """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
    37
  """
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
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
    39
  #: 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
    40
  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
    41
      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
    42
  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
    43
  
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
  #: 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
    45
  #: 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
    46
  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
    47
      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
    48
  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
    49
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
    50
  #: 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
    51
  #: 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
    52
  #: 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
    53
  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
    54
                                 required=True, collection_name="groups",
344
d135c8c09967 Change verbose_name of founder property in Group model from "Created by" to "Founded by". Add GROUP_TYPE_SHORT and GROUP_TYPE_PLURAL for all models that inherit from Group and use that values in templates and contexts. Assume that group_type, group_type_short and group_type_plural are defined in context and remove not needed ifs in templates. Rename "Linkname" to "Link name" in list/group_heading.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 333
diff changeset
    55
                                 verbose_name=ugettext_lazy('Founded by'))
d135c8c09967 Change verbose_name of founder property in Group model from "Created by" to "Founded by". Add GROUP_TYPE_SHORT and GROUP_TYPE_PLURAL for all models that inherit from Group and use that values in templates and contexts. Assume that group_type, group_type_short and group_type_plural are defined in context and remove not needed ifs in templates. Rename "Linkname" to "Link name" in list/group_heading.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 333
diff changeset
    56
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
    57
  #: 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
    58
  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
    59
      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
    60
  
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
    61
  #: 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
    62
  #: 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
    63
  #: 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
    64
  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
    65
      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
    66
  
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
    67
  #: 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
    68
  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
    69
      verbose_name=ugettext_lazy('Description'))
772
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    70
 
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    71
  #: 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
    72
  pub_mailing_list = db.StringProperty(required=False,
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    73
    verbose_name=ugettext_lazy('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
    74
  pub_mailing_list.help_text = ugettext_lazy(
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    75
    '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
    76
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    77
  #: 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
    78
  irc_channel = db.StringProperty(required=False,
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    79
    verbose_name=ugettext_lazy('Public IRC Channel (and Network)'))
a91f7856754e Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents: 685
diff changeset
    80
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
    81
  #: 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
    82
  #: 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
    83
  #: 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
    84
  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
    85
      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
    86
  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
    87
      '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
    88
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
    89
  #: 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
    90
  #: 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
    91
  #: 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
    92
  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
    93
      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
    94
  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
    95
685
a440ced9a75f Comment fixes for state in group and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 683
diff changeset
    96
  #: Optional 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
    97
  #: 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
    98
  #: text, because, if supplied, it is used as a shipping address.
683
de829096b814 Changed state property for models/group.py to be optional as the description states.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 534
diff changeset
    99
  state = db.StringProperty(
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
   100
      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
   101
  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
   102
      '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
   103
      '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
   104
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
   105
  #: Required field containing address country or territory of the group.
259
74eb6b01c82c Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 208
diff changeset
   106
  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
   107
      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
   108
      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
   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 postal code of the group (ZIP code in
181
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
   111
  #: 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
   112
  #: 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
   113
  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
   114
      verbose_name=ugettext_lazy('ZIP/Postal Code'))
385
6d410bf49a82 Remove not used imports in models. Fix missing spaces in models when operator not preceded by a space. Add missing ugettext_lazy import to Proposal model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 363
diff changeset
   115
  postalcode.help_text = ugettext_lazy('lower ASCII characters only')
181
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 174
diff changeset
   116
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
   117
  #: 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
   118
  #: 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
   119
  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
   120
      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
   121
  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
   122
      '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
   123
e55cad180973 Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents: 772
diff changeset
   124
  member_template = db.ReferenceProperty(
e55cad180973 Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents: 772
diff changeset
   125
    reference_class=soc.models.document.Document, required=False,
e55cad180973 Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents: 772
diff changeset
   126
    collection_name='group_app_member_template',
e55cad180973 Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents: 772
diff changeset
   127
    verbose_name=ugettext_lazy('Application template '))
e55cad180973 Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents: 772
diff changeset
   128
  member_template.help_text = ugettext_lazy(
e55cad180973 Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents: 772
diff changeset
   129
    'This template will be presented to potential members when they'
e55cad180973 Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents: 772
diff changeset
   130
    ' apply to the group.')
e55cad180973 Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents: 772
diff changeset
   131