app/soc/models/role.py
changeset 1371 2d97dbbb4d99
parent 1360 f62c462037b6
child 1407 423425ac79f5
equal deleted inserted replaced
1370:8d684e64fbbe 1371:2d97dbbb4d99
   172   #: it may be used as a shipping address.
   172   #: it may be used as a shipping address.
   173   res_street = db.StringProperty(required=True,
   173   res_street = db.StringProperty(required=True,
   174       verbose_name=ugettext('Street address'))
   174       verbose_name=ugettext('Street address'))
   175   res_street.help_text = ugettext(
   175   res_street.help_text = ugettext(
   176       'street number and name, lower ASCII characters only')
   176       'street number and name, lower ASCII characters only')
   177   res_street.group=ugettext("Contact Info")
   177   res_street.group=ugettext("2. Contact Info")
   178 
   178 
   179   #: Required field containing residence address city; kept private.
   179   #: Required field containing residence address city; kept private.
   180   #: Residence city can only be lower ASCII, not UTF-8 text, because it
   180   #: Residence city can only be lower ASCII, not UTF-8 text, because it
   181   #: may be used as a shipping address.
   181   #: may be used as a shipping address.
   182   res_city = db.StringProperty(required=True,
   182   res_city = db.StringProperty(required=True,
   183       verbose_name=ugettext('City'))
   183       verbose_name=ugettext('City'))
   184   res_city.help_text = ugettext('lower ASCII characters only')
   184   res_city.help_text = ugettext('lower ASCII characters only')
   185   res_city.group=ugettext("Contact Info")
   185   res_city.group=ugettext("2. Contact Info")
   186 
   186 
   187   #: Optional field containing residence address state or province; kept
   187   #: Optional field containing residence address state or province; kept
   188   #: private.  Residence state/province can only be lower ASCII, not UTF-8
   188   #: private.  Residence state/province can only be lower ASCII, not UTF-8
   189   #: text, because it may be used as a shipping address.
   189   #: text, because it may be used as a shipping address.
   190   res_state = db.StringProperty(
   190   res_state = db.StringProperty(
   191       verbose_name=ugettext('State/Province'))
   191       verbose_name=ugettext('State/Province'))
   192   res_state.help_text = ugettext(
   192   res_state.help_text = ugettext(
   193       'optional if country/territory does not have states or provinces, '
   193       'optional if country/territory does not have states or provinces, '
   194       'lower ASCII characters only')
   194       'lower ASCII characters only')
   195   res_state.group=ugettext("Contact Info")
   195   res_state.group=ugettext("2. Contact Info")
   196 
   196 
   197   #: Required field containing residence address country or territory; kept
   197   #: Required field containing residence address country or territory; kept
   198   #: private.
   198   #: private.
   199   res_country = db.StringProperty(required=True,
   199   res_country = db.StringProperty(required=True,
   200       verbose_name=ugettext('Country/Territory'),
   200       verbose_name=ugettext('Country/Territory'),
   201       choices=countries.COUNTRIES_AND_TERRITORIES)
   201       choices=countries.COUNTRIES_AND_TERRITORIES)
   202   res_country.group=ugettext("Contact Info")
   202   res_country.group=ugettext("2. Contact Info")
   203 
   203 
   204   #: Required field containing residence address postal code (ZIP code in
   204   #: Required field containing residence address postal code (ZIP code in
   205   #: the United States); kept private.  Residence postal code can only be
   205   #: the United States); kept private.  Residence postal code can only be
   206   #: lower ASCII, not UTF-8 text, because it may be used as a shipping address.
   206   #: lower ASCII, not UTF-8 text, because it may be used as a shipping address.
   207   res_postalcode = db.StringProperty(required=True,
   207   res_postalcode = db.StringProperty(required=True,
   208       verbose_name=ugettext('ZIP/Postal Code'))
   208       verbose_name=ugettext('ZIP/Postal Code'))
   209   res_postalcode.help_text = ugettext('lower ASCII characters only')
   209   res_postalcode.help_text = ugettext('lower ASCII characters only')
   210   res_postalcode.group=ugettext("Contact Info")
   210   res_postalcode.group=ugettext("2. Contact Info")
       
   211 
       
   212   #: field storing whether the User has agreed to publish his location
       
   213   publish_location = db.BooleanProperty(required=False, default=False,
       
   214       verbose_name=ugettext('Publish my location'))
       
   215   publish_location.help_text = ugettext(
       
   216       'Indicates whether the user agreed to publish location.')
       
   217   publish_location.group=ugettext("3. Contact Info")
   211 
   218 
   212   #: Optional field containing a separate shipping street address; kept
   219   #: Optional field containing a separate shipping street address; kept
   213   #: private.  If shipping address is not present in its entirety, the
   220   #: private.  If shipping address is not present in its entirety, the
   214   #: residence address will be used instead.  Shipping street address can only
   221   #: residence address will be used instead.  Shipping street address can only
   215   #: be lower ASCII, not UTF-8 text, because, if supplied, it is used as a
   222   #: be lower ASCII, not UTF-8 text, because, if supplied, it is used as a
   216   #: shipping address.
   223   #: shipping address.
   217   ship_street = db.StringProperty(
   224   ship_street = db.StringProperty(
   218       verbose_name=ugettext('Shipping Street address'))
   225       verbose_name=ugettext('Shipping Street address'))
   219   ship_street.help_text = ugettext(
   226   ship_street.help_text = ugettext(
   220       'street number and name, lower ASCII characters only')
   227       'street number and name, lower ASCII characters only')
   221   ship_street.group=ugettext("Shipping Info")
   228   ship_street.group=ugettext("4. Shipping Info")
   222 
   229 
   223   #: Optional field containing shipping address city; kept private.
   230   #: Optional field containing shipping address city; kept private.
   224   #: Shipping city can only be lower ASCII, not UTF-8 text, because, if
   231   #: Shipping city can only be lower ASCII, not UTF-8 text, because, if
   225   #: supplied, it is used as a shipping address.
   232   #: supplied, it is used as a shipping address.
   226   ship_city = db.StringProperty(
   233   ship_city = db.StringProperty(
   227       verbose_name=ugettext('Shipping City'))
   234       verbose_name=ugettext('Shipping City'))
   228   ship_city.help_text = ugettext('lower ASCII characters only')
   235   ship_city.help_text = ugettext('lower ASCII characters only')
   229   ship_city.group=ugettext("Shipping Info")
   236   ship_city.group=ugettext("4. Shipping Info")
   230 
   237 
   231   #: Optional field containing shipping address state or province; kept
   238   #: Optional field containing shipping address state or province; kept
   232   #: private.  Shipping state/province can only be lower ASCII, not UTF-8
   239   #: private.  Shipping state/province can only be lower ASCII, not UTF-8
   233   #: text, because, if supplied, it is used as a shipping address.
   240   #: text, because, if supplied, it is used as a shipping address.
   234   ship_state = db.StringProperty(
   241   ship_state = db.StringProperty(
   235       verbose_name=ugettext('Shipping State/Province'))
   242       verbose_name=ugettext('Shipping State/Province'))
   236   ship_state.help_text = ugettext(
   243   ship_state.help_text = ugettext(
   237       'optional if country/territory does not have states or provinces, '
   244       'optional if country/territory does not have states or provinces, '
   238       'lower ASCII characters only')
   245       'lower ASCII characters only')
   239   ship_state.group=ugettext("Shipping Info")
   246   ship_state.group=ugettext("4. Shipping Info")
   240 
   247 
   241   #: Optional field containing shipping address country or territory; kept
   248   #: Optional field containing shipping address country or territory; kept
   242   #: private.
   249   #: private.
   243   ship_country = db.StringProperty(
   250   ship_country = db.StringProperty(
   244       verbose_name=ugettext('Shipping Country/Territory'),
   251       verbose_name=ugettext('Shipping Country/Territory'),
   245       choices=countries.COUNTRIES_AND_TERRITORIES)
   252       choices=countries.COUNTRIES_AND_TERRITORIES)
   246   ship_country.group=ugettext("Shipping Info")
   253   ship_country.group=ugettext("4. Shipping Info")
   247 
   254 
   248   #: Optional field containing shipping address postal code (ZIP code in
   255   #: Optional field containing shipping address postal code (ZIP code in
   249   #: the United States); kept private.  Shipping postal code can only be
   256   #: the United States); kept private.  Shipping postal code can only be
   250   #: lower ASCII, not UTF-8 text, because, if supplied, it is used as a
   257   #: lower ASCII, not UTF-8 text, because, if supplied, it is used as a
   251   #: shipping address.
   258   #: shipping address.
   252   ship_postalcode = db.StringProperty(
   259   ship_postalcode = db.StringProperty(
   253       verbose_name=ugettext('Shipping ZIP/Postal Code'))
   260       verbose_name=ugettext('Shipping ZIP/Postal Code'))
   254   ship_postalcode.help_text = ugettext('lower ASCII characters only')
   261   ship_postalcode.help_text = ugettext('lower ASCII characters only')
   255   ship_postalcode.group=ugettext("Shipping Info")
   262   ship_postalcode.group=ugettext("4. Shipping Info")
   256 
   263 
   257   #: Required field containing a phone number that will be supplied
   264   #: Required field containing a phone number that will be supplied
   258   #: to shippers; kept private.
   265   #: to shippers; kept private.
   259   phone = db.PhoneNumberProperty(
   266   phone = db.PhoneNumberProperty(
   260       required=True,
   267       required=True,
   261       verbose_name=ugettext('Phone Number'))
   268       verbose_name=ugettext('Phone Number'))
   262   phone.help_text = ugettext(
   269   phone.help_text = ugettext(
   263       'include complete international calling number with country code')
   270       'include complete international calling number with country code')
   264   phone.group=ugettext("Shipping Info")
   271   phone.group=ugettext("4. Shipping Info")
   265   
   272   
   266 
   273 
   267   #====================================================================
   274   #====================================================================
   268   # (private) personal information
   275   # (private) personal information
   269   #====================================================================
   276   #====================================================================
   273   birth_date = db.DateProperty(
   280   birth_date = db.DateProperty(
   274       required=True,
   281       required=True,
   275       verbose_name=ugettext('Birth Date'))
   282       verbose_name=ugettext('Birth Date'))
   276   birth_date.help_text = ugettext(
   283   birth_date.help_text = ugettext(
   277       'required for determining program eligibility')
   284       'required for determining program eligibility')
   278   birth_date.group=ugettext("Private Info")
   285   birth_date.group=ugettext("5. Private Info")
   279 
   286 
   280   #: Optional field indicating choice of t-shirt, from XXS to XXXL;
   287   #: Optional field indicating choice of t-shirt, from XXS to XXXL;
   281   #: kept private.
   288   #: kept private.
   282   tshirt_size = db.StringProperty(
   289   tshirt_size = db.StringProperty(
   283       verbose_name=ugettext('T-shirt Size'),
   290       verbose_name=ugettext('T-shirt Size'),
   284       choices=('XXS', 'XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'))
   291       choices=('XXS', 'XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'))
   285   tshirt_size.group=ugettext("Private Info")
   292   tshirt_size.group=ugettext("5. Private Info")
   286 
   293 
   287   #: Optional field indicating choice of t-shirt fit; kept private.
   294   #: Optional field indicating choice of t-shirt fit; kept private.
   288   tshirt_style = db.StringProperty(
   295   tshirt_style = db.StringProperty(
   289       verbose_name=ugettext('T-shirt Style'),
   296       verbose_name=ugettext('T-shirt Style'),
   290       choices=('male', 'female'))
   297       choices=('male', 'female'))
   291   tshirt_style.group=ugettext("Private Info")
   298   tshirt_style.group=ugettext("5. Private Info")
   292 
   299 
   293   #: field storing wheter the User has agreed to the site-wide Terms of Service.
   300   #: field storing wheter the User has agreed to the site-wide Terms of Service.
   294   #: (Not a required field because the Terms of Service might not be present
   301   #: (Not a required field because the Terms of Service might not be present
   295   #: when the first User profile is created when bootstrapping the site.)
   302   #: when the first User profile is created when bootstrapping the site.)
   296   agreed_to_tos = db.BooleanProperty(required=False, default=False,
   303   agreed_to_tos = db.BooleanProperty(required=False, default=False,
   297       verbose_name=ugettext('I Agree to the Terms of Service'))
   304       verbose_name=ugettext('I Agree to the Terms of Service'))
   298   agreed_to_tos.help_text = ugettext(
   305   agreed_to_tos.help_text = ugettext(
   299       'Indicates whether the user agreed to this role Terms of Service.')
   306       'Indicates whether the user agreed to this role Terms of Service.')
   300   agreed_to_tos.group=ugettext("Terms of Service")
   307   agreed_to_tos.group=ugettext("6. Terms of Service")
   301 
   308 
   302   #: field storing when the User has agreed to the site-wide Terms of Service.
   309   #: field storing when the User has agreed to the site-wide Terms of Service.
   303   #: (Not a required field because the Terms of Service might not be present
   310   #: (Not a required field because the Terms of Service might not be present
   304   #: when the first User profile is created when bootstrapping the site.)
   311   #: when the first User profile is created when bootstrapping the site.)
   305   agreed_to_tos_on = db.DateTimeProperty(required=False, default=None,
   312   agreed_to_tos_on = db.DateTimeProperty(required=False, default=None,
   306       verbose_name=ugettext('Has agreed to the Terms of Service on'))
   313       verbose_name=ugettext('Has agreed to the Terms of Service on'))
   307   agreed_to_tos_on.help_text = ugettext(
   314   agreed_to_tos_on.help_text = ugettext(
   308       'Indicates when the user agreed to this role Terms of Service.')
   315       'Indicates when the user agreed to this role Terms of Service.')
   309   agreed_to_tos.group=ugettext("Terms of Service")
   316   agreed_to_tos.group=ugettext("6. Terms of Service")
   310 
   317 
   311   #: field storing the status of this role
   318   #: field storing the status of this role
   312   #: Active means that this role can exercise all it's privileges.
   319   #: Active means that this role can exercise all it's privileges.
   313   #: Invalid mean that this role cannot exercise it's privileges.
   320   #: Invalid mean that this role cannot exercise it's privileges.
   314   #: Inactive means that this role cannot exercise it's data-editing
   321   #: Inactive means that this role cannot exercise it's data-editing
   319       choices=['active','invalid','inactive'],
   326       choices=['active','invalid','inactive'],
   320       verbose_name=ugettext('Status of this Role'))
   327       verbose_name=ugettext('Status of this Role'))
   321   status.help_text = ugettext(
   328   status.help_text = ugettext(
   322       'Indicates the status of the role concerning which privileges may be used.')
   329       'Indicates the status of the role concerning which privileges may be used.')
   323 
   330 
   324   #: field storing whether the User has agreed to publish his location
       
   325   publish_location = db.BooleanProperty(required=False, default=False,
       
   326       verbose_name=ugettext('Publish my location'))
       
   327   publish_location.help_text = ugettext(
       
   328       'Indicates whether the user agreed to publish location.')
       
   329 
       
   330   def name(self):
   331   def name(self):
   331     """Property as 'name' for use in common templates.
   332     """Property as 'name' for use in common templates.
   332     """
   333     """
   333     if self.name_on_certificates:
   334     if self.name_on_certificates:
   334       return self.name_on_certificates
   335       return self.name_on_certificates