app/soc/models/group_app.py
author Sverre Rabbelier <srabbelier@gmail.com>
Wed, 07 Jan 2009 21:57:12 +0000
changeset 776 f86a76f52bf4
parent 774 88a827a9b614
child 786 6d802e596a96
permissions -rw-r--r--
Started on edit timeline Added a gsoc timeline logic module. Also added a scope_path as the key_field to timeline. Updated the django_paterns to only include the edit field and removed link_id as dynafield. Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     2
#
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     8
# 
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    10
# 
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    17
"""This module contains the Group Application Model."""
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    18
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    19
__authors__ = [
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
  '"Todd Larsen" <tlarsen@google.com>',
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    21
]
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    22
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    23
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    24
from google.appengine.ext import db
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    25
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    26
from django.utils.translation import ugettext_lazy
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    27
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    28
import soc.models.document
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    29
import soc.models.linkable
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    30
import soc.models.user
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    31
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    32
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    33
class GroupApplication(soc.models.linkable.Linkable):
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    34
  """Common application questions for all groups.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    35
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    36
  Eventually, this will be replaced with a Question/Answer/Quiz/Response
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    37
  approach.  At that time, existing OrgApplication entities will be migrated
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    38
  (converted) to their new representations in the Datastore.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    39
  """
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    40
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    41
  #: Required field that will become the name of the Group in the profile,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    42
  #: if the Group Application is accepted.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    43
  #: See also:  soc.models.group.Group.name
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    44
  name = db.StringProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    45
      verbose_name=ugettext_lazy('Group Name'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    46
  name.help_text = ugettext_lazy('Complete, formal name of the group.')  
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    47
  
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    48
  #: Required many:1 relationship indicating the User who is applying on
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    49
  #: behalf of the Group.  If the Group Application is accepted, this User
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    50
  #: will become the founding User of the Group.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    51
  #: See also:  soc.models.group.Group.founder
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    52
  applicant = db.ReferenceProperty(reference_class=soc.models.user.User,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    53
    required=True, collection_name='group_apps',
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    54
    verbose_name=ugettext_lazy('Applicant'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    55
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    56
  #: Required field indicating the home page URL of the applying Group.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    57
  #: See also:  soc.models.group.Group.home_page
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    58
  home_page = db.LinkProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    59
      verbose_name=ugettext_lazy('Home Page URL'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    60
  
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    61
  #: Required email address used as the "public" contact mechanism for
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    62
  #: the Group (as opposed to the applicant.account email address which is
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    63
  #: kept secret, revealed only to Developers).
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    64
  #: See also:  soc.models.group.Group.email
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    65
  email = db.EmailProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    66
    verbose_name=ugettext_lazy('Public Email'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    67
  
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    68
  #: Required description of the Group.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    69
  description = db.TextProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    70
      verbose_name=ugettext_lazy('Description'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    71
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    72
  why_applying = db.TextProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    73
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    74
      'Why is your group applying to participate?'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    75
      ' What do you hope to gain by participating?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    76
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    77
  prior_participation = db.TextProperty(required=False,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    78
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    79
      'Has your group participated previously?'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    80
      ' If so, please summarize your involvement and any past successes'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    81
      ' and failures. (optional)'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    82
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    83
  prior_application = db.TextProperty(required=False,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    84
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    85
      'If your group has not previously participated, have you applied in'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    86
      ' the past?  If so, for what sort of participation? (optional)'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    87
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    88
  pub_mailing_list = db.StringProperty(required=False,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    89
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    90
      'What is the main public mailing list for your group? (optional)'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    91
  pub_mailing_list.help_text = ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    92
    'Mailing list email address, URL to sign-up page, etc.')
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    93
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    94
  irc_channel = db.StringProperty(required=False,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    95
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    96
      'Where is the main IRC channel for your group?'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    97
      ' (optional)'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    98
  irc_channel.help_text = ugettext_lazy('IRC network and channel.')
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    99
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   100
  backup_admin = db.ReferenceProperty(reference_class=soc.models.user.User,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   101
    required=True,  collection_name='group_app_backup_admin',
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   102
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   103
      'Please select your backup group administrator.'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   104
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   105
  member_criteria = db.TextProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   106
    verbose_text=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   107
      'What criteria do you use to select the members of your group?'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   108
      ' Please be as specific as possible.'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   109
  member_disappears = ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   110
    'Members include mentors, admininstrators, and the like.')
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   111
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   112
  member_template = db.ReferenceProperty(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   113
    reference_class=soc.models.document.Document, required=False,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   114
    collection_name='group_app_member_template',
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   115
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   116
      'Please select the application template you would like potential'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   117
      ' members of your group to use.  (optional).'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   118
  contrib_template.help_text = ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   119
    'This template will be presented to potential members when they'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   120
    ' apply to the group.')