app/soc/models/role.py
author Lennard de Rijk <ljvderijk@gmail.com>
Thu, 13 Aug 2009 10:46:53 -0700
changeset 2768 97a1569b2743
parent 2698 5783338b2c8d
permissions -rw-r--r--
Added methods that give the shipping information for a role entity. The shipping fields are only given when all the required address fields are set. Otherwise the residential fields are returned.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
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.
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
     8
#
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    10
#
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    17
"""This module contains the Role Model."""
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    18
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    19
__authors__ = [
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
  '"Todd Larsen" <tlarsen@google.com>',
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    22
  '"Pawel Solyga" <pawel.solyga@gmail.com>',
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    23
]
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    24
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    25
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    26
from google.appengine.ext import db
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    27
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
    28
from django.utils.translation import ugettext
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    29
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    30
from soc.models import countries
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    31
533
ba3309b2fd30 Move LINK_ID and SCOPE_PATH regular expressions to soc/models/linkable.py.
Todd Larsen <tlarsen@google.com>
parents: 481
diff changeset
    32
import soc.models.linkable
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    33
import soc.models.user
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    34
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    35
533
ba3309b2fd30 Move LINK_ID and SCOPE_PATH regular expressions to soc/models/linkable.py.
Todd Larsen <tlarsen@google.com>
parents: 481
diff changeset
    36
class Role(soc.models.linkable.Linkable):
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    37
  """Information common to Program participation for all Roles.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    38
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    39
  Some details of a Role are considered "public" information, and nearly
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    40
  all of these are optional (except for given_name, surname, and email).
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    41
  Other details of a Role are kept "private" and are only provided to
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    42
  other Users in roles that "need to know" this information.  How these
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    43
  fields are revealed is usually covered by Program terms of service.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    44
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    45
  Role is the entity that is created when a User actually participates
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    46
  in some fashion in a Program. Role details could *possibly* be collected
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    47
  without actual participation (voluntary, opt-in, of course).
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    48
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    49
  A Role is a User's participation in a single Program.  To avoid
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    50
  duplication of data entry, facilities will be available for selecting
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    51
  an existing Role associated with a particular User to be duplicated for
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    52
  participation in a new Program.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    53
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    54
  A User has to have at least one Role in order to be able to create
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    55
  any Work (such as a Document) on the site.  The easiest-to-obtain Role is
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    56
  probably Club Member (though Clubs can set their own membership criteria).
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    57
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    58
  A Role entity participates in the following relationships implemented
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    59
  as a db.ReferenceProperty elsewhere in another db.Model:
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    60
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    61
   documentation) a 1:many relationship of Documentation (tax forms,
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    62
     letters from schools, etc.) associated with the Role by Hosts.  This
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    63
     relation is implemented as the 'documentation' back-reference Query of
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    64
     the Documentation model 'role' reference.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    65
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    66
   works) a many:many relationship with Works, stored in a separate
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    67
     WorksRoles model, representing the Work authored by this Role.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    68
     See the WorksRoles model class for details.
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    69
  """
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    70
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    71
  #: A required many:1 relationship that ties (possibly multiple
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    72
  #: entities of) Role details to a unique User. A Role cannot
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    73
  #: exist unassociated from a login identity and credentials. The
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    74
  #: back-reference in the User model is a Query named 'roles'.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    75
  user = db.ReferenceProperty(reference_class=soc.models.user.User,
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    76
                              required=True, collection_name='roles')
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    77
845
255faade3e30 Add the agrees_to_tos property to Roles (as its own changeset this time...).
Todd Larsen <tlarsen@google.com>
parents: 842
diff changeset
    78
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    79
  #====================================================================
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    80
  #  (public) name information
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    81
  #====================================================================
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    82
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    83
  #: Required field storing the parts of the Role's name
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    84
  #: corresponding to the field names; displayed publicly.
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
    85
  #: given_name can only be ASCII, not UTF-8 text, because it is
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    86
  #: used, for example, as part of the shipping (mailing) address.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    87
  given_name = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
    88
      verbose_name=ugettext('First (given) name'))
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
    89
  given_name.help_text = ugettext(
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
    90
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
    91
  given_name.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    92
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    93
  #: Required field storing the parts of the Role's name
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    94
  #: corresponding to the field names; displayed publicly.
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
    95
  #: Surname can only be ASCII, not UTF-8 text, because it is
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    96
  #: used, for example, as part of the shipping (mailing) address.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    97
  surname = db.StringProperty(
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
    98
      required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
    99
      verbose_name=ugettext('Last (family) name'))
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   100
  surname.help_text = ugettext(
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   101
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   102
  surname.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   103
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   104
  #: Optional field used as a display name, such as for awards
1131
9dd535241841 Changed display_name to name_on_certificates in models/role.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1090
diff changeset
   105
  #: certificates. Should be the entire name in the format
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   106
  #: the Role would like it displayed (could be surname followed by
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   107
  #: given name in some cultures, for example). Display names can be
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   108
  #: any valid UTF-8 text.
1132
046668855732 Replace name_on_certificates property with name_on_documents, since mentors, club admins, hosts and org admins don't get certificates it's better to name it 'Name on documents' which can indicate any kind of documents including awards certificates. Also don't show name_on_documents in public Role profiles, instead show user public name in that place.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1131
diff changeset
   109
  name_on_documents = db.StringProperty(
046668855732 Replace name_on_certificates property with name_on_documents, since mentors, club admins, hosts and org admins don't get certificates it's better to name it 'Name on documents' which can indicate any kind of documents including awards certificates. Also don't show name_on_documents in public Role profiles, instead show user public name in that place.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1131
diff changeset
   110
      verbose_name=ugettext('Name on documents'))
046668855732 Replace name_on_certificates property with name_on_documents, since mentors, club admins, hosts and org admins don't get certificates it's better to name it 'Name on documents' which can indicate any kind of documents including awards certificates. Also don't show name_on_documents in public Role profiles, instead show user public name in that place.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1131
diff changeset
   111
  name_on_documents.help_text = ugettext(
046668855732 Replace name_on_certificates property with name_on_documents, since mentors, club admins, hosts and org admins don't get certificates it's better to name it 'Name on documents' which can indicate any kind of documents including awards certificates. Also don't show name_on_documents in public Role profiles, instead show user public name in that place.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1131
diff changeset
   112
      'Optional field used as a display name, such as for documents like '
046668855732 Replace name_on_certificates property with name_on_documents, since mentors, club admins, hosts and org admins don't get certificates it's better to name it 'Name on documents' which can indicate any kind of documents including awards certificates. Also don't show name_on_documents in public Role profiles, instead show user public name in that place.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1131
diff changeset
   113
      'awards certificates. Should be the entire name in the format '
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   114
      'the person would like it displayed (could be family name followed '
1132
046668855732 Replace name_on_certificates property with name_on_documents, since mentors, club admins, hosts and org admins don't get certificates it's better to name it 'Name on documents' which can indicate any kind of documents including awards certificates. Also don't show name_on_documents in public Role profiles, instead show user public name in that place.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1131
diff changeset
   115
      'by given name in some cultures, for example). Name on documents can be '
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   116
      'any valid UTF-8 text.')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   117
  name_on_documents.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   118
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   119
  #====================================================================
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   120
  #  (public) contact information
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   121
  #====================================================================
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   122
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   123
  #: Optional field storing Instant Messaging network; displayed publicly.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   124
  im_network = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   125
      verbose_name=ugettext('IM Network'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   126
  im_network.help_text = ugettext(
1595
c36a10ae7a0f Fixed a typo in the example for network info
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1420
diff changeset
   127
      'examples: irc:irc.freenode.net xmpp:gmail.com/Home')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   128
  im_network.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   129
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   130
  #: Optional field storing Instant Messaging handle; displayed publicly.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   131
  im_handle = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   132
      verbose_name=ugettext('IM Handle'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   133
  im_handle.help_text = ugettext(
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   134
      'personal identifier, such as: screen name, IRC nick, user name')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   135
  im_handle.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   136
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   137
  #: Optional field storing a home page URL; displayed publicly.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   138
  home_page = db.LinkProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   139
      verbose_name=ugettext('Home Page URL'))
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   140
  home_page.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   141
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   142
  #: Optional field storing a blog URL; displayed publicly.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   143
  blog = db.LinkProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   144
      verbose_name=ugettext('Blog URL'))
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   145
  blog.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   146
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   147
  #: Optional field storing a URL to an image, expected to be a
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   148
  #: personal photo (or cartoon avatar, perhaps); displayed publicly.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   149
  photo_url = db.LinkProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   150
      verbose_name=ugettext('Thumbnail Photo URL'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   151
  photo_url.help_text = ugettext(
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   152
      'URL of 64x64 pixel thumbnail image')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   153
  photo_url.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   154
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   155
  #: Optional field storing the latitude provided by the Role; displayed
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   156
  #: publicly.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   157
  latitude = db.FloatProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   158
      verbose_name=ugettext('Latitude'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   159
  latitude.help_text = ugettext(
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   160
      'decimal degrees northerly (N), use minus sign (-) for southerly (S)')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   161
  latitude.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   162
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   163
  #: Optional field storing the longitude provided by the Role; displayed
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   164
  #: publicly.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   165
  longitude = db.FloatProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   166
      verbose_name=ugettext('Longitude'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   167
  longitude.help_text = ugettext(
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   168
      'decimal degrees easterly (E), use minus sign (-) for westerly (W)')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   169
  longitude.group = ugettext("1. Public Info")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   170
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   171
  #====================================================================
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   172
  # (private) contact information
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   173
  #====================================================================
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   174
2264
c8697d928065 Email address is actually private, not public, make this obvios
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2249
diff changeset
   175
  #: Required field used as the contact mechanism for the program
c8697d928065 Email address is actually private, not public, make this obvios
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2249
diff changeset
   176
  #: Role (for example the address the system sends emails to).
c8697d928065 Email address is actually private, not public, make this obvios
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2249
diff changeset
   177
  email = db.EmailProperty(
c8697d928065 Email address is actually private, not public, make this obvios
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2249
diff changeset
   178
      required=True,
c8697d928065 Email address is actually private, not public, make this obvios
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2249
diff changeset
   179
      verbose_name=ugettext('Email Address'))
c8697d928065 Email address is actually private, not public, make this obvios
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2249
diff changeset
   180
  email.group = ugettext("2. Contact Info (Private)")
c8697d928065 Email address is actually private, not public, make this obvios
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2249
diff changeset
   181
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   182
  #: Required field containing residence street address; kept private.
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   183
  #: Residence street address can only be ASCII, not UTF-8 text, because
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   184
  #: it may be used as a shipping address.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   185
  res_street = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   186
      verbose_name=ugettext('Street address'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   187
  res_street.help_text = ugettext(
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   188
      'street number and name, '
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   189
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   190
  res_street.group = ugettext("2. Contact Info (Private)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   191
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   192
  #: Required field containing residence address city; kept private.
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   193
  #: Residence city can only be ASCII, not UTF-8 text, because it
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   194
  #: may be used as a shipping address.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   195
  res_city = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   196
      verbose_name=ugettext('City'))
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   197
  res_city.help_text = ugettext(
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   198
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   199
  res_city.group = ugettext("2. Contact Info (Private)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   200
685
a440ced9a75f Comment fixes for state in group and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 577
diff changeset
   201
  #: Optional field containing residence address state or province; kept
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   202
  #: private.  Residence state/province can only be ASCII, not UTF-8
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   203
  #: text, because it may be used as a shipping address.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   204
  res_state = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   205
      verbose_name=ugettext('State/Province'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   206
  res_state.help_text = ugettext(
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   207
      'optional if country/territory does not have states or provinces, '
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   208
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   209
  res_state.group = ugettext("2. Contact Info (Private)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   210
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   211
  #: Required field containing residence address country or territory; kept
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   212
  #: private.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   213
  res_country = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   214
      verbose_name=ugettext('Country/Territory'),
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   215
      choices=countries.COUNTRIES_AND_TERRITORIES)
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   216
  res_country.group = ugettext("2. Contact Info (Private)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   217
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   218
  #: Required field containing residence address postal code (ZIP code in
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   219
  #: the United States); kept private.  Residence postal code can only be
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   220
  #: ASCII, not UTF-8 text, because it may be used as a shipping address.
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   221
  res_postalcode = db.StringProperty(required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   222
      verbose_name=ugettext('ZIP/Postal Code'))
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   223
  res_postalcode.help_text = ugettext(
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   224
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   225
  res_postalcode.group = ugettext("2. Contact Info (Private)")
1410
20580c5272e4 Fixed grouping and updated help text
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1407
diff changeset
   226
20580c5272e4 Fixed grouping and updated help text
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1407
diff changeset
   227
  #: Required field containing a phone number that will be used to
20580c5272e4 Fixed grouping and updated help text
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1407
diff changeset
   228
  #: contact the user, also supplied to shippers; kept private.
20580c5272e4 Fixed grouping and updated help text
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1407
diff changeset
   229
  phone = db.PhoneNumberProperty(
20580c5272e4 Fixed grouping and updated help text
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1407
diff changeset
   230
      required=True,
20580c5272e4 Fixed grouping and updated help text
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1407
diff changeset
   231
      verbose_name=ugettext('Phone Number'))
20580c5272e4 Fixed grouping and updated help text
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1407
diff changeset
   232
  phone.help_text = ugettext(
20580c5272e4 Fixed grouping and updated help text
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1407
diff changeset
   233
      'include complete international calling number with country code')
1961
85a57ba6f6fa Added example text to the phone number fields
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1627
diff changeset
   234
  phone.example_text = ugettext(
85a57ba6f6fa Added example text to the phone number fields
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1627
diff changeset
   235
      "e.g. 1650253000 for Google's Corp HQ number in the United States")
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   236
  phone.group = ugettext("2. Contact Info (Private)")
1371
2d97dbbb4d99 Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1360
diff changeset
   237
2d97dbbb4d99 Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1360
diff changeset
   238
  #: field storing whether the User has agreed to publish his location
2d97dbbb4d99 Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1360
diff changeset
   239
  publish_location = db.BooleanProperty(required=False, default=False,
2d97dbbb4d99 Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1360
diff changeset
   240
      verbose_name=ugettext('Publish my location'))
2d97dbbb4d99 Implemented simple group sorted using numerical ordering
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1360
diff changeset
   241
  publish_location.help_text = ugettext(
2698
5783338b2c8d Edited the role form to clarify the intention of the checkbox+marker.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2264
diff changeset
   242
      'By checking this box, you are agreeing to allow your location to be'
5783338b2c8d Edited the role form to clarify the intention of the checkbox+marker.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2264
diff changeset
   243
      ' displayed, as given by the Marker below, on any map.'
5783338b2c8d Edited the role form to clarify the intention of the checkbox+marker.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2264
diff changeset
   244
      ' For instance on the map linking Students to Mentors or'
2165
ab1ff1608258 Add (better) help_text to publish_location and school_name
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2162
diff changeset
   245
      ' by showing your location on your public profile page in the system.')
2698
5783338b2c8d Edited the role form to clarify the intention of the checkbox+marker.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2264
diff changeset
   246
  publish_location.example_text = ugettext('You can set your location below')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   247
  publish_location.group = ugettext("2. Contact Info (Private)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   248
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   249
  #: Optional field containing a separate shipping street address; kept
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   250
  #: private.  If shipping address is not present in its entirety, the
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   251
  #: residence address will be used instead.  Shipping street address can only
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   252
  #: be ASCII, not UTF-8 text, because, if supplied, it is used as a
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   253
  #: shipping address.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   254
  ship_street = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   255
      verbose_name=ugettext('Shipping Street address'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   256
  ship_street.help_text = ugettext(
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   257
      'street number and name, '
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   258
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only'
1410
20580c5272e4 Fixed grouping and updated help text
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1407
diff changeset
   259
      'fill in only if not same as above')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   260
  ship_street.group = ugettext("3. Shipping Info (Private and Optional)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   261
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   262
  #: Optional field containing shipping address city; kept private.
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   263
  #: Shipping city can only be ASCII, not UTF-8 text, because, if
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   264
  #: supplied, it is used as a shipping address.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   265
  ship_city = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   266
      verbose_name=ugettext('Shipping City'))
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   267
  ship_city.help_text = ugettext(
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   268
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only'
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   269
      'fill in only if not same as above')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   270
  ship_city.group = ugettext("3. Shipping Info (Private and Optional)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   271
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   272
  #: Optional field containing shipping address state or province; kept
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   273
  #: private.  Shipping state/province can only be ASCII, not UTF-8
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   274
  #: text, because, if supplied, it is used as a shipping address.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   275
  ship_state = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   276
      verbose_name=ugettext('Shipping State/Province'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   277
  ship_state.help_text = ugettext(
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   278
      'optional if country/territory does not have states or provinces, '
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   279
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only '
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   280
      'fill in only if not same as above')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   281
  ship_state.group = ugettext("3. Shipping Info (Private and Optional)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   282
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   283
  #: Optional field containing shipping address country or territory; kept
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   284
  #: private.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   285
  ship_country = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   286
      verbose_name=ugettext('Shipping Country/Territory'),
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   287
      choices=countries.COUNTRIES_AND_TERRITORIES)
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   288
  ship_country.help_text = ugettext('fill in only if not same as above')
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   289
  ship_country.group = ugettext("3. Shipping Info (Private and Optional)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   290
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   291
  #: Optional field containing shipping address postal code (ZIP code in
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   292
  #: the United States); kept private.  Shipping postal code can only be
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   293
  #: ASCII, not UTF-8 text, because, if supplied, it is used as a
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   294
  #: shipping address.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   295
  ship_postalcode = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   296
      verbose_name=ugettext('Shipping ZIP/Postal Code'))
2162
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   297
  ship_postalcode.help_text = ugettext(
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   298
      '<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only'
03ed2fa5ccc8 Lower ASCII fix
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2074
diff changeset
   299
      'fill in only if not same as above')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   300
  ship_postalcode.group = ugettext("3. Shipping Info (Private and Optional)")
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   301
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   302
  #====================================================================
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   303
  # (private) personal information
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   304
  #====================================================================
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   305
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   306
  #: Required field containing the Role's birthdate (for
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   307
  #: determining Program participation eligibility); kept private.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   308
  birth_date = db.DateProperty(
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   309
      required=True,
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   310
      verbose_name=ugettext('Birth Date'))
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   311
  birth_date.help_text = ugettext(
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   312
      'required for determining program eligibility')
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   313
  birth_date.group = ugettext("4. Private Info")
2040
f1370e1d0871 Added example text to birth_date.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2017
diff changeset
   314
  birth_date.example_text = ugettext(
f1370e1d0871 Added example text to birth_date.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2017
diff changeset
   315
      'e.g. 1999-12-31 or 12/31/1999')
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   316
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   317
  #: Optional field indicating choice of t-shirt, from XXS to XXXL;
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   318
  #: kept private.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   319
  tshirt_size = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   320
      verbose_name=ugettext('T-shirt Size'),
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   321
      choices=('XXS', 'XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'))
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   322
  tshirt_size.group = ugettext("4. Private Info")
1987
dd0ba04ef589 Add example text on t-shirt sizes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1979
diff changeset
   323
  tshirt_size.example_text = ugettext('See also '
dd0ba04ef589 Add example text on t-shirt sizes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1979
diff changeset
   324
      '<a href="http://en.wikipedia.org/wiki/US_standard_clothing_size">'
dd0ba04ef589 Add example text on t-shirt sizes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1979
diff changeset
   325
      'this article</a>.')
474
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   326
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   327
  #: Optional field indicating choice of t-shirt fit; kept private.
0bf5af57cef9 Move all the properties from Person model to Role model. Update all the comments and docs according to the changes. Remove Person model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 385
diff changeset
   328
  tshirt_style = db.StringProperty(
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 913
diff changeset
   329
      verbose_name=ugettext('T-shirt Style'),
533
ba3309b2fd30 Move LINK_ID and SCOPE_PATH regular expressions to soc/models/linkable.py.
Todd Larsen <tlarsen@google.com>
parents: 481
diff changeset
   330
      choices=('male', 'female'))
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   331
  tshirt_style.group = ugettext("4. Private Info")
913
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   332
1076
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   333
  #: field storing wheter the User has agreed to the site-wide Terms of Service.
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   334
  #: (Not a required field because the Terms of Service might not be present
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   335
  #: when the first User profile is created when bootstrapping the site.)
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   336
  agreed_to_tos = db.BooleanProperty(required=False, default=False,
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   337
      verbose_name=ugettext('I Agree to the Terms of Service'))
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   338
  agreed_to_tos.help_text = ugettext(
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   339
      'Indicates whether the user agreed to this role Terms of Service.')
1979
365f6a145223 Push agreements to group 99 for Role forms.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1961
diff changeset
   340
  agreed_to_tos.group = ugettext("99. Terms of Service")
1076
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   341
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   342
  #: field storing when the User has agreed to the site-wide Terms of Service.
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   343
  #: (Not a required field because the Terms of Service might not be present
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   344
  #: when the first User profile is created when bootstrapping the site.)
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   345
  agreed_to_tos_on = db.DateTimeProperty(required=False, default=None,
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   346
      verbose_name=ugettext('Has agreed to the Terms of Service on'))
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   347
  agreed_to_tos_on.help_text = ugettext(
063194eaf87b Added agreed_to_tos_on field in user and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1046
diff changeset
   348
      'Indicates when the user agreed to this role Terms of Service.')
1979
365f6a145223 Push agreements to group 99 for Role forms.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1961
diff changeset
   349
  agreed_to_tos.group = ugettext("99. Terms of Service")
577
e7cb5819f7e9 Provide a simple method in the Role Model class that aliases the existing
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
   350
1085
0afbdd0905ef Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1076
diff changeset
   351
  #: field storing the status of this role
913
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   352
  #: Active means that this role can exercise all it's privileges.
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   353
  #: Invalid mean that this role cannot exercise it's privileges.
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   354
  #: Inactive means that this role cannot exercise it's data-editing
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   355
  #: privileges but should be able to see the data. For instance when a program
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   356
  #: has been marked inactive an Organization Admin should still be able to see
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   357
  #: the student applications.
1085
0afbdd0905ef Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1076
diff changeset
   358
  status = db.StringProperty(default='active',
913
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   359
      choices=['active','invalid','inactive'],
1085
0afbdd0905ef Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1076
diff changeset
   360
      verbose_name=ugettext('Status of this Role'))
1627
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   361
  status.help_text = ugettext('Indicates the status of the role '
425dccf4f652 Style and too long lines fixes in soc.models.role module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1595
diff changeset
   362
      'concerning which privileges may be used.')
1360
f62c462037b6 Added grouping support to all forms, converted role as example
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1308
diff changeset
   363
577
e7cb5819f7e9 Provide a simple method in the Role Model class that aliases the existing
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
   364
  def name(self):
1131
9dd535241841 Changed display_name to name_on_certificates in models/role.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1090
diff changeset
   365
    """Property as 'name' for use in common templates.
577
e7cb5819f7e9 Provide a simple method in the Role Model class that aliases the existing
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
   366
    """
2074
5c75312566d5 Fix too long lines, style and remove unused imports in soc.models modules.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2040
diff changeset
   367
    return '%s %s' % (self.given_name, self.surname)
2017
bde6efa3df3f Added document_name alias for use on award certificates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2015
diff changeset
   368
bde6efa3df3f Added document_name alias for use on award certificates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2015
diff changeset
   369
  def document_name(self):
bde6efa3df3f Added document_name alias for use on award certificates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2015
diff changeset
   370
    """Property as 'document_name' used on for example award certificates.
bde6efa3df3f Added document_name alias for use on award certificates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2015
diff changeset
   371
    """
bde6efa3df3f Added document_name alias for use on award certificates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2015
diff changeset
   372
    if self.name_on_documents:
bde6efa3df3f Added document_name alias for use on award certificates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2015
diff changeset
   373
      return self.name_on_documents
bde6efa3df3f Added document_name alias for use on award certificates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2015
diff changeset
   374
    else:
bde6efa3df3f Added document_name alias for use on award certificates.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2015
diff changeset
   375
      return self.name()
2249
08d1367deb4f Added ccTld property to role to retrieve the ccTld of the country of residence for a specific role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2165
diff changeset
   376
2768
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   377
  def shipping_street(self):
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   378
    """Property shipping_street that returns shipping street if
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   379
    shipping address is set else the residential street.
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   380
    """
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   381
    return self.ship_street if self.hasShippingAddress() else self.res_street
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   382
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   383
  def shipping_city(self):
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   384
    """Property shipping_city that returns shipping city if
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   385
    shipping address is set else the residential city.
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   386
    """
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   387
    return self.ship_city if self.hasShippingAddress() else self.res_city
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   388
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   389
  def shipping_state(self):
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   390
    """Property shipping_state that returns shipping state if
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   391
    shipping address is set else the residential state.
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   392
    """
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   393
    return self.ship_state if self.hasShippingAddress() else self.res_state
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   394
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   395
  def shipping_country(self):
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   396
    """Property shipping_country that returns shipping country if
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   397
    shipping address is set else the residential country.
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   398
    """
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   399
    return self.ship_country if self.hasShippingAddress() else self.res_country
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   400
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   401
  def shipping_postalcode(self):
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   402
    """Property shipping_postalcode that returns the shipping postal code if
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   403
    shipping address set else the residential postal code.
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   404
    """
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   405
    return self.ship_postalcode if self.hasShippingAddress() else \
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   406
        self.res_postalcode
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   407
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   408
  def hasShippingAddress(self):
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   409
    """Checks if the required fields for the shipping address are set.
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   410
    """
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   411
    return self.ship_city and self.ship_country and self.ship_postalcode and \
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   412
        self.ship_street
97a1569b2743 Added methods that give the shipping information for a role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2698
diff changeset
   413
2249
08d1367deb4f Added ccTld property to role to retrieve the ccTld of the country of residence for a specific role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2165
diff changeset
   414
  def ccTld(self):
08d1367deb4f Added ccTld property to role to retrieve the ccTld of the country of residence for a specific role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2165
diff changeset
   415
    """Property as 'ccTld' for use in Maps.
08d1367deb4f Added ccTld property to role to retrieve the ccTld of the country of residence for a specific role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2165
diff changeset
   416
    """
08d1367deb4f Added ccTld property to role to retrieve the ccTld of the country of residence for a specific role entity.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2165
diff changeset
   417
    return countries.COUNTRIES_TO_CCTLD[self.res_country]