app/soc/models/group.py
changeset 970 8b5611d5b053
parent 834 b60c9ccbeaa5
child 1060 eb6231138307
equal deleted inserted replaced
969:b12de918d660 970:8b5611d5b053
    22 ]
    22 ]
    23 
    23 
    24 
    24 
    25 from google.appengine.ext import db
    25 from google.appengine.ext import db
    26 
    26 
    27 from django.utils.translation import ugettext_lazy
    27 from django.utils.translation import ugettext
    28 
    28 
    29 from soc.models import countries
    29 from soc.models import countries
    30 
    30 
    31 import soc.models.presence
    31 import soc.models.presence
    32 import soc.models.user
    32 import soc.models.user
    36   """Common data fields for all groups.
    36   """Common data fields for all groups.
    37   """
    37   """
    38 
    38 
    39   #: Required field storing name of the group.
    39   #: Required field storing name of the group.
    40   name = db.StringProperty(required=True,
    40   name = db.StringProperty(required=True,
    41       verbose_name=ugettext_lazy('Name'))
    41       verbose_name=ugettext('Name'))
    42   name.help_text = ugettext_lazy('Complete, formal name of the group.')  
    42   name.help_text = ugettext('Complete, formal name of the group.')  
    43   
    43   
    44   #: Required field storing short name of the group.
    44   #: Required field storing short name of the group.
    45   #: It can be used for displaying group as sidebar menu item.
    45   #: It can be used for displaying group as sidebar menu item.
    46   short_name = db.StringProperty(required=True,
    46   short_name = db.StringProperty(required=True,
    47       verbose_name=ugettext_lazy('Short name'))
    47       verbose_name=ugettext('Short name'))
    48   short_name.help_text = ugettext_lazy('Short name used for sidebar menu')
    48   short_name.help_text = ugettext('Short name used for sidebar menu')
    49 
    49 
    50   #: Required many:1 relationship indicating the founding User of the
    50   #: Required many:1 relationship indicating the founding User of the
    51   #: Group (this relationship is needed to keep track of lifetime group
    51   #: Group (this relationship is needed to keep track of lifetime group
    52   #: creation limits, used to prevent spamming, etc.).
    52   #: creation limits, used to prevent spamming, etc.).
    53   founder = db.ReferenceProperty(reference_class=soc.models.user.User,
    53   founder = db.ReferenceProperty(reference_class=soc.models.user.User,
    54                                  required=True, collection_name="groups",
    54                                  required=True, collection_name="groups",
    55                                  verbose_name=ugettext_lazy('Founded by'))
    55                                  verbose_name=ugettext('Founded by'))
    56 
    56 
    57   #: Required field storing a home page URL of the group.
    57   #: Required field storing a home page URL of the group.
    58   home_page = db.LinkProperty(required=True,
    58   home_page = db.LinkProperty(required=True,
    59       verbose_name=ugettext_lazy('Home Page URL'))
    59       verbose_name=ugettext('Home Page URL'))
    60   
    60   
    61   #: Required email address used as the "public" contact mechanism for
    61   #: Required email address used as the "public" contact mechanism for
    62   #: the Group (as opposed to the founder.account email address which is
    62   #: the Group (as opposed to the founder.account email address which is
    63   #: kept secret, revealed only to Developers).
    63   #: kept secret, revealed only to Developers).
    64   email = db.EmailProperty(required=True,
    64   email = db.EmailProperty(required=True,
    65       verbose_name=ugettext_lazy('Email'))  
    65       verbose_name=ugettext('Email'))  
    66   
    66   
    67   #: Required field storing description of the group.
    67   #: Required field storing description of the group.
    68   description = db.TextProperty(required=True,
    68   description = db.TextProperty(required=True,
    69       verbose_name=ugettext_lazy('Description'))
    69       verbose_name=ugettext('Description'))
    70  
    70  
    71   #: Optional public mailing list.     
    71   #: Optional public mailing list.     
    72   pub_mailing_list = db.StringProperty(required=False,
    72   pub_mailing_list = db.StringProperty(required=False,
    73     verbose_name=ugettext_lazy('Public Mailing List'))
    73     verbose_name=ugettext('Public Mailing List'))
    74   pub_mailing_list.help_text = ugettext_lazy(
    74   pub_mailing_list.help_text = ugettext(
    75     'Mailing list email address, URL to sign-up page, etc.')
    75     'Mailing list email address, URL to sign-up page, etc.')
    76 
    76 
    77   #: Optional public IRC channel.
    77   #: Optional public IRC channel.
    78   irc_channel = db.StringProperty(required=False,
    78   irc_channel = db.StringProperty(required=False,
    79     verbose_name=ugettext_lazy('Public IRC Channel (and Network)'))
    79     verbose_name=ugettext('Public IRC Channel (and Network)'))
    80 
    80 
    81   #: Required field containing a group street address.
    81   #: Required field containing a group street address.
    82   #: Group street address can only be lower ASCII, not UTF-8 text, 
    82   #: Group street address can only be lower ASCII, not UTF-8 text, 
    83   #: because, if supplied, it is used as a shipping address.
    83   #: because, if supplied, it is used as a shipping address.
    84   street = db.StringProperty(required=True,
    84   street = db.StringProperty(required=True,
    85       verbose_name=ugettext_lazy('Street address'))
    85       verbose_name=ugettext('Street address'))
    86   street.help_text = ugettext_lazy(
    86   street.help_text = ugettext(
    87       'street number and name, lower ASCII characters only')
    87       'street number and name, lower ASCII characters only')
    88 
    88 
    89   #: Required field containing group address city.
    89   #: Required field containing group address city.
    90   #: City can only be lower ASCII, not UTF-8 text, because, if
    90   #: City can only be lower ASCII, not UTF-8 text, because, if
    91   #: supplied, it is used as a shipping address.
    91   #: supplied, it is used as a shipping address.
    92   city = db.StringProperty(required=True,
    92   city = db.StringProperty(required=True,
    93       verbose_name=ugettext_lazy('City'))
    93       verbose_name=ugettext('City'))
    94   city.help_text = ugettext_lazy('lower ASCII characters only')
    94   city.help_text = ugettext('lower ASCII characters only')
    95 
    95 
    96   #: Optional field containing group address state or province.
    96   #: Optional field containing group address state or province.
    97   #: Group state/province can only be lower ASCII, not UTF-8
    97   #: Group state/province can only be lower ASCII, not UTF-8
    98   #: text, because, if supplied, it is used as a shipping address.
    98   #: text, because, if supplied, it is used as a shipping address.
    99   state = db.StringProperty(
    99   state = db.StringProperty(
   100       verbose_name=ugettext_lazy('State/Province'))
   100       verbose_name=ugettext('State/Province'))
   101   state.help_text = ugettext_lazy(
   101   state.help_text = ugettext(
   102       'optional if country/territory does not have states or provinces, '
   102       'optional if country/territory does not have states or provinces, '
   103       'lower ASCII characters only')
   103       'lower ASCII characters only')
   104 
   104 
   105   #: Required field containing address country or territory of the group.
   105   #: Required field containing address country or territory of the group.
   106   country = db.StringProperty(required=True,
   106   country = db.StringProperty(required=True,
   107       verbose_name=ugettext_lazy('Country/Territory'),
   107       verbose_name=ugettext('Country/Territory'),
   108       choices=countries.COUNTRIES_AND_TERRITORIES)
   108       choices=countries.COUNTRIES_AND_TERRITORIES)
   109 
   109 
   110   #: Required field containing address postal code of the group (ZIP code in
   110   #: 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 
   111   #: 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.
   112   #: text, because, if supplied, it is used as a shipping address.
   113   postalcode = db.StringProperty(required=True,
   113   postalcode = db.StringProperty(required=True,
   114       verbose_name=ugettext_lazy('ZIP/Postal Code'))
   114       verbose_name=ugettext('ZIP/Postal Code'))
   115   postalcode.help_text = ugettext_lazy('lower ASCII characters only')
   115   postalcode.help_text = ugettext('lower ASCII characters only')
   116 
   116 
   117   #: Required contact phone number that will be, amongst other uses,
   117   #: Required contact phone number that will be, amongst other uses,
   118   #: supplied to shippers along with the shipping address; kept private.
   118   #: supplied to shippers along with the shipping address; kept private.
   119   phone = db.PhoneNumberProperty(required=True,
   119   phone = db.PhoneNumberProperty(required=True,
   120       verbose_name=ugettext_lazy('Phone Number'))
   120       verbose_name=ugettext('Phone Number'))
   121   phone.help_text = ugettext_lazy(
   121   phone.help_text = ugettext(
   122       'include complete international calling number with country code')
   122       'include complete international calling number with country code')
   123 
   123