app/soc/models/group.py
changeset 1060 eb6231138307
parent 970 8b5611d5b053
child 1085 0afbdd0905ef
equal deleted inserted replaced
1059:17221b578fe7 1060:eb6231138307
    16 
    16 
    17 """This module contains the Group Model."""
    17 """This module contains the Group Model."""
    18 
    18 
    19 __authors__ = [
    19 __authors__ = [
    20   '"Todd Larsen" <tlarsen@google.com>',
    20   '"Todd Larsen" <tlarsen@google.com>',
       
    21   '"Lennard de Rijk" <ljvderijk@gmail.com>',
    21   '"Pawel Solyga" <pawel.solyga@gmail.com>',
    22   '"Pawel Solyga" <pawel.solyga@gmail.com>',
    22 ]
    23 ]
    23 
    24 
    24 
    25 
    25 from google.appengine.ext import db
    26 from google.appengine.ext import db
    76 
    77 
    77   #: Optional public IRC channel.
    78   #: Optional public IRC channel.
    78   irc_channel = db.StringProperty(required=False,
    79   irc_channel = db.StringProperty(required=False,
    79     verbose_name=ugettext('Public IRC Channel (and Network)'))
    80     verbose_name=ugettext('Public IRC Channel (and Network)'))
    80 
    81 
       
    82   #====================================================================
       
    83   # (private) contact information
       
    84   #====================================================================
       
    85 
    81   #: Required field containing a group street address.
    86   #: Required field containing a group street address.
    82   #: Group street address can only be lower ASCII, not UTF-8 text, 
    87   #: Group street address can only be lower ASCII, not UTF-8 text, 
    83   #: because, if supplied, it is used as a shipping address.
    88   #: because, if supplied, it might be used as a shipping address.
    84   street = db.StringProperty(required=True,
    89   contact_street = db.StringProperty(required=True,
    85       verbose_name=ugettext('Street address'))
    90       verbose_name=ugettext('Street address'))
    86   street.help_text = ugettext(
    91   contact_street.help_text = ugettext(
    87       'street number and name, lower ASCII characters only')
    92       'street number and name, lower ASCII characters only')
    88 
    93 
    89   #: Required field containing group address city.
    94   #: Required field containing group address city.
    90   #: City can only be lower ASCII, not UTF-8 text, because, if
    95   #: City can only be lower ASCII, not UTF-8 text, because, if
    91   #: supplied, it is used as a shipping address.
    96   #: supplied, it might be used as a shipping address.
    92   city = db.StringProperty(required=True,
    97   contact_city = db.StringProperty(required=True,
    93       verbose_name=ugettext('City'))
    98       verbose_name=ugettext('City'))
    94   city.help_text = ugettext('lower ASCII characters only')
    99   contact_city.help_text = ugettext('lower ASCII characters only')
    95 
   100 
    96   #: Optional field containing group address state or province.
   101   #: Required field containing group address state or province.
    97   #: Group state/province can only be lower ASCII, not UTF-8
   102   #: Group state/province can only be lower ASCII, not UTF-8
    98   #: text, because, if supplied, it is used as a shipping address.
   103   #: text, because, if supplied, it might be used as a shipping address.
    99   state = db.StringProperty(
   104   contact_state = db.StringProperty(
   100       verbose_name=ugettext('State/Province'))
   105       verbose_name=ugettext('State/Province'))
   101   state.help_text = ugettext(
   106   contact_state.help_text = ugettext(
   102       'optional if country/territory does not have states or provinces, '
   107       'optional if country/territory does not have states or provinces, '
   103       'lower ASCII characters only')
   108       'lower ASCII characters only')
   104 
   109 
   105   #: Required field containing address country or territory of the group.
   110   #: Required field containing address country or territory of the group.
   106   country = db.StringProperty(required=True,
   111   contact_country = db.StringProperty(required=True,
   107       verbose_name=ugettext('Country/Territory'),
   112       verbose_name=ugettext('Country/Territory'),
   108       choices=countries.COUNTRIES_AND_TERRITORIES)
   113       choices=countries.COUNTRIES_AND_TERRITORIES)
   109 
   114 
   110   #: Required field containing address postal code of the group (ZIP code in
   115   #: Required field containing address postal code of the group (ZIP code in
   111   #: the United States). Postal code can only be lower ASCII, not UTF-8 
   116   #: the United States).Postal code can only be lower ASCII, not UTF-8 
   112   #: text, because, if supplied, it is used as a shipping address.
   117   #: text, because, if supplied, it might be used as a shipping address.
   113   postalcode = db.StringProperty(required=True,
   118   contact_postalcode = db.StringProperty(required=True,
   114       verbose_name=ugettext('ZIP/Postal Code'))
   119       verbose_name=ugettext('ZIP/Postal Code'))
   115   postalcode.help_text = ugettext('lower ASCII characters only')
   120   contact_postalcode.help_text = ugettext('lower ASCII characters only')
   116 
   121 
   117   #: Required contact phone number that will be, amongst other uses,
   122   #: Required contact phone number that will be, amongst other uses,
   118   #: supplied to shippers along with the shipping address; kept private.
   123   #: supplied to shippers along with the shipping address; kept private.
   119   phone = db.PhoneNumberProperty(required=True,
   124   phone = db.PhoneNumberProperty(required=True,
   120       verbose_name=ugettext('Phone Number'))
   125       verbose_name=ugettext('Phone Number'))
   121   phone.help_text = ugettext(
   126   phone.help_text = ugettext(
   122       'include complete international calling number with country code')
   127       'include complete international calling number with country code')
   123 
   128 
       
   129   #====================================================================
       
   130   # (private) shipping information
       
   131   #====================================================================
       
   132 
       
   133   #: Optional field containing a group street address.
       
   134   #: Group street address can only be lower ASCII, not UTF-8 text, 
       
   135   #: because, if supplied, it is used as a shipping address.
       
   136   shipping_street = db.StringProperty(required=False,
       
   137       verbose_name=ugettext('Shipping Street address'))
       
   138   shipping_street.help_text = ugettext(
       
   139       'street number and name, lower ASCII characters only')
       
   140 
       
   141   #: Optional field containing group address city.
       
   142   #: City can only be lower ASCII, not UTF-8 text, because, if
       
   143   #: supplied, it is used as a shipping address.
       
   144   shipping_city = db.StringProperty(required=False,
       
   145       verbose_name=ugettext('Shipping City'))
       
   146   shipping_city.help_text = ugettext('lower ASCII characters only')
       
   147 
       
   148   #: Optional field containing group address state or province.
       
   149   #: Group state/province can only be lower ASCII, not UTF-8
       
   150   #: text, because, if supplied, it is used as a shipping address.
       
   151   shipping_state = db.StringProperty(
       
   152       verbose_name=ugettext('Shipping State/Province'))
       
   153   shipping_state.help_text = ugettext(
       
   154       'optional if country/territory does not have states or provinces, '
       
   155       'lower ASCII characters only')
       
   156 
       
   157   #: Optional field containing address postal code of the group (ZIP code in
       
   158   #: the United States). Postal code can only be lower ASCII, not UTF-8 
       
   159   #: text, because, if supplied, it is used as a shipping address.
       
   160   shipping_postalcode = db.StringProperty(required=False,
       
   161       verbose_name=ugettext('Shipping ZIP/Postal Code'))
       
   162   shipping_postalcode.help_text = ugettext('lower ASCII characters only')
       
   163 
       
   164   #: Optional field containing address country or territory of the group.
       
   165   shipping_country = db.StringProperty(required=False,
       
   166       verbose_name=ugettext('Shipping Country/Territory'),
       
   167       choices=countries.COUNTRIES_AND_TERRITORIES)
       
   168 
       
   169   #: Required property showing the current state of the group
       
   170   #: new: the group has not been active yet
       
   171   #: active: the group is active
       
   172   #: inactive: used to mark a group as read-only
       
   173   #: invalid: the group has been marked as removed
       
   174   state = db.StringProperty(required=True, default='new',
       
   175       choices=['new', 'active', 'inactive', 'invalid'])
       
   176