app/soc/models/role.py
author Lennard de Rijk <ljvderijk@gmail.com>
Fri, 23 Jan 2009 09:08:26 +0000
changeset 913 db38e7680d1c
parent 879 05082afd4b6e
child 970 8b5611d5b053
permissions -rw-r--r--
Added state property to role model. This can be used when for instance a member has been removed from a club or a when a program has been marked inactive. Certain roles would then be shown on the upcoming roles page marked as previous roles. This would give us the archiving capability that was shown in the mockup. Patch by: Lennard de Rijk Reviewd by: to-be-reviewed
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
#
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
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
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
    28
from django.utils.translation import ugettext_lazy
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.
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
    85
  #: given_name can only be lower ASCII, not UTF-8 text, because it is
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,
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
    88
      verbose_name=ugettext_lazy('First (given) 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
    89
  given_name.help_text = ugettext_lazy('lower ASCII characters only')
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
    90
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
    91
  #: 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
    92
  #: corresponding to the field names; 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
    93
  #: Surname can only be lower ASCII, not UTF-8 text, because it is
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
  #: 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
    95
  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
    96
      required=True,
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
      verbose_name=ugettext_lazy('Last (family) 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
    98
  surname.help_text = ugettext_lazy('lower ASCII characters only')
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
    99
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
   100
  #: Optional field used as a display name, such as for awards
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
   101
  #: certificates. Should be the entire display name in the format
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
   102
  #: 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
   103
  #: 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
   104
  #: any valid UTF-8 text.
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
   105
  display_name = 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
   106
      verbose_name=ugettext_lazy('Display 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
   107
  display_name.help_text = ugettext_lazy(
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
      'Optional field used as a display name, such as for awards '
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
   109
      'certificates. Should be the entire display name in the format '
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
   110
      'the person would like it displayed (could be family name followed '
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
   111
      'by 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
   112
      'any valid UTF-8 text.')
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
   113
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
  #====================================================================
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
   115
  #  (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
   116
  #====================================================================
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
   117
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
  #: Required field used as the 'public' contact mechanism for the
481
94834a1e6c01 Attempt to rename User.id to User.account, in preparation for making User be
Todd Larsen <tlarsen@google.com>
parents: 474
diff changeset
   119
  #: Role (as opposed to the user.account email address which 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
   120
  #: kept secret).
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
  email = db.EmailProperty(
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
      required=True,
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
      verbose_name=ugettext_lazy('Email 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
   124
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
   125
  #: 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
   126
  im_network = 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
   127
      verbose_name=ugettext_lazy('IM Network'))
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
   128
  im_network.help_text = ugettext_lazy(
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
      'examples: irc:irc.freenode.org xmpp:gmail.com/Home')
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
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
  #: 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
   132
  im_handle = 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
   133
      verbose_name=ugettext_lazy('IM Handle'))
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
  im_handle.help_text = ugettext_lazy(
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
   135
      'personal identifier, such as: screen name, IRC nick, user 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
   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(
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
   139
      verbose_name=ugettext_lazy('Home Page URL'))
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
   140
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
  #: 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
   142
  blog = db.LinkProperty(
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
      verbose_name=ugettext_lazy('Blog URL'))
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
   144
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
   145
  #: 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
   146
  #: 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
   147
  photo_url = db.LinkProperty(
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
      verbose_name=ugettext_lazy('Thumbnail Photo URL'))
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.help_text = ugettext_lazy(
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
   150
      'URL of 64x64 pixel thumbnail image')
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
   151
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
  #: 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
   153
  #: 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
   154
  latitude = db.FloatProperty(
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
      verbose_name=ugettext_lazy('Latitude'))
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
  latitude.help_text = ugettext_lazy(
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
      'decimal degrees northerly (N), use minus sign (-) for southerly (S)')
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
   158
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
   159
  #: 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
   160
  #: 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
   161
  longitude = db.FloatProperty(
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
      verbose_name=ugettext_lazy('Longitude'))
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
  longitude.help_text = ugettext_lazy(
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
      'decimal degrees easterly (E), use minus sign (-) for westerly (W)')
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
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
   166
  #====================================================================
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
   167
  # (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
   168
  #====================================================================
207
8ecc2e4198cd Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   169
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
  #: Required field containing residence street address; 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
   171
  #: Residence street address can only be lower ASCII, not UTF-8 text, because
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
  #: 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
   173
  res_street = db.StringProperty(required=True,
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
   174
      verbose_name=ugettext_lazy('Street 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
   175
  res_street.help_text = ugettext_lazy(
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
   176
      'street number and name, lower ASCII characters only')
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
   177
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
   178
  #: Required field containing residence address city; 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
   179
  #: Residence city can only be lower ASCII, not UTF-8 text, because it
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
   180
  #: 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
   181
  res_city = db.StringProperty(required=True,
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
      verbose_name=ugettext_lazy('City'))
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
   183
  res_city.help_text = ugettext_lazy('lower ASCII characters only')
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
685
a440ced9a75f Comment fixes for state in group and role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 577
diff changeset
   185
  #: Optional field containing residence address state or province; kept
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
   186
  #: private.  Residence state/province can only be lower ASCII, not UTF-8
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
   187
  #: 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
   188
  res_state = 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
   189
      verbose_name=ugettext_lazy('State/Province'))
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
   190
  res_state.help_text = ugettext_lazy(
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
      'optional if country/territory does not have states or provinces, '
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
      'lower ASCII characters only')
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
   193
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
  #: 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
   195
  #: 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
   196
  res_country = db.StringProperty(required=True,
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
   197
      verbose_name=ugettext_lazy('Country/Territory'),
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
   198
      choices=countries.COUNTRIES_AND_TERRITORIES)
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
   199
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
  #: 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
   201
  #: the United States); kept private.  Residence postal code can only 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
   202
  #: lower ASCII, not UTF-8 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
   203
  res_postalcode = db.StringProperty(required=True,
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
      verbose_name=ugettext_lazy('ZIP/Postal Code'))
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
   205
  res_postalcode.help_text = ugettext_lazy('lower ASCII characters only')
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
   206
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 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
   208
  #: 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
   209
  #: residence address will be used instead.  Shipping street address can only
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
  #: be lower ASCII, not UTF-8 text, because, if supplied, it is used as 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
   211
  #: 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
   212
  ship_street = db.StringProperty(
879
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   213
      verbose_name=ugettext_lazy('Shipping Street 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
   214
  ship_street.help_text = ugettext_lazy(
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
      'street number and name, lower ASCII characters only')
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
   216
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
  #: Optional field containing shipping address city; 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
   218
  #: Shipping city can only be lower ASCII, not UTF-8 text, because, if
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
  #: 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
   220
  ship_city = db.StringProperty(
879
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   221
      verbose_name=ugettext_lazy('Shipping City'))
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
   222
  ship_city.help_text = ugettext_lazy('lower ASCII characters only')
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
   223
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
   224
  #: Optional field containing shipping address state or province; 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
   225
  #: private.  Shipping state/province can only be lower ASCII, not UTF-8
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
   226
  #: 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
   227
  ship_state = db.StringProperty(
879
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   228
      verbose_name=ugettext_lazy('Shipping State/Province'))
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
   229
  ship_state.help_text = ugettext_lazy(
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
   230
      'optional if country/territory does not have states or provinces, '
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
   231
      'lower ASCII characters only')
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
   232
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
   233
  #: 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
   234
  #: 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
   235
  ship_country = db.StringProperty(
879
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   236
      verbose_name=ugettext_lazy('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
   237
      choices=countries.COUNTRIES_AND_TERRITORIES)
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
   238
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
   239
  #: 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
   240
  #: the United States); kept private.  Shipping postal code can only 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
   241
  #: lower ASCII, not UTF-8 text, because, if supplied, it is used as 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
   242
  #: 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
   243
  ship_postalcode = db.StringProperty(
879
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   244
      verbose_name=ugettext_lazy('Shipping ZIP/Postal Code'))
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
   245
  ship_postalcode.help_text = ugettext_lazy('lower ASCII characters only')
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
   246
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
   247
  #: Required field containing a phone number that will be supplied
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
  #: to shippers; 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
   249
  phone = db.PhoneNumberProperty(
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
      required=True,
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
      verbose_name=ugettext_lazy('Phone Number'))
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
   252
  phone.help_text = ugettext_lazy(
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
      'include complete international calling number with country code')
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
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
   255
  #====================================================================
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
   256
  # (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
   257
  #====================================================================
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
   258
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
   259
  #: 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
   260
  #: 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
   261
  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
   262
      required=True,
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
   263
      verbose_name=ugettext_lazy('Birth Date'))
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
  birth_date.help_text = ugettext_lazy(
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
      'required for determining program eligibility')
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
   266
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
   267
  #: 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
   268
  #: 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
   269
  tshirt_size = 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
   270
      verbose_name=ugettext_lazy('T-shirt Size'),
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
      choices=('XXS', 'XS', 'S', 'M', 'L', 'XL', 'XXL', '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
   272
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
   273
  #: 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
   274
  tshirt_style = 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
   275
      verbose_name=ugettext_lazy('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
   276
      choices=('male', 'female'))
913
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   277
879
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   278
  #: field storing whether User has agreed to the Role-specific Terms of
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   279
  #: Service. (Not a required field because some Roles may not have special
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   280
  #: Terms of Service.)
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   281
  agrees_to_tos = db.BooleanProperty(
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   282
      verbose_name=ugettext_lazy('Agrees to ToS'))
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   283
  agrees_to_tos.help_text = ugettext_lazy(
05082afd4b6e Changes in Role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 845
diff changeset
   284
      'Indicates that the user agrees to the Terms of Service for this Role.')
577
e7cb5819f7e9 Provide a simple method in the Role Model class that aliases the existing
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
   285
913
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   286
  #: field storing the state of this role
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   287
  #: 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
   288
  #: 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
   289
  #: 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
   290
  #: 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
   291
  #: 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
   292
  #: the student applications.
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   293
  state = db.StringProperty(default='active',
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   294
      choices=['active','invalid','inactive'],
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   295
      verbose_name=ugettext_lazy('State of this Role'))
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   296
  state.help_text = ugettext_lazy(
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   297
      'Indicates the state of the role concerning which privileges may be used')
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   298
db38e7680d1c Added state property to role model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 879
diff changeset
   299
577
e7cb5819f7e9 Provide a simple method in the Role Model class that aliases the existing
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
   300
  def name(self):
e7cb5819f7e9 Provide a simple method in the Role Model class that aliases the existing
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
   301
    """Alias 'display_name' Property as 'name' for use in common templates.
e7cb5819f7e9 Provide a simple method in the Role Model class that aliases the existing
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
   302
    """
e7cb5819f7e9 Provide a simple method in the Role Model class that aliases the existing
Todd Larsen <tlarsen@google.com>
parents: 533
diff changeset
   303
    return self.display_name