app/soc/models/org_app.py
author Lennard de Rijk <ljvderijk@gmail.com>
Fri, 23 Jan 2009 09:08:26 +0000
changeset 913 db38e7680d1c
parent 795 8914adaa93a7
child 936 b3e1e0c9649c
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:
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 Organization 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.group_app
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 OrgApplication(soc.models.group_app.GroupApplication):
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    34
  """Specialized questions for the Organization application.
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
  These questions are in addition to those in the GroupApplication Model.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    37
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    38
  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
    39
  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
    40
  (converted) to their new representations in the Datastore.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    41
  """
795
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    42
  
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    43
  prior_participation = db.TextProperty(required=False,
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    44
    verbose_name=ugettext_lazy(
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    45
      'Has your group participated previously?'
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    46
      ' If so, please summarize your involvement and any past successes'
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    47
      ' and failures.'))
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    48
795
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    49
  prior_application = db.TextProperty(required=False,
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    50
    verbose_name=ugettext_lazy(
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    51
      'If your group has not previously participated, have you applied in'
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    52
      ' the past?  If so, for what sort of participation?'))
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    53
  
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    54
  license_name = db.StringProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    55
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    56
      'What license does your organization use?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    57
 
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    58
  ideas = db.ReferenceProperty(reference_class=soc.models.document.Document,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    59
    required=True, collection_name='ideas_app',
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    60
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    61
      'Please select the Document containing your ideas list.'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    62
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    63
  dev_mailing_list = db.StringProperty(required=False,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    64
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    65
      'What is the main development mailing list for your group?'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    66
      ' (optional)'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    67
  dev_mailing_list.help_text = ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    68
    '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
    69
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    70
  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
    71
    required=False,  collection_name='backup_admin_app',
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    72
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    73
      'Please select your backup group administrator (if there is one).'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    74
      ' They will be emailed to confirm, and this group will not be '
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    75
      ' accepted until they respond. (optional).'))
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
  contrib_template = db.ReferenceProperty(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    78
    reference_class=soc.models.document.Document, required=False,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    79
    collection_name='org_app_contrib_template',
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    80
    verbose_name=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    81
      'Please select the application template you would like contributors'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    82
      ' to your group to use.  (optional).'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    83
  contrib_template.help_text = ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    84
    'This template will be presented to contributors, such as students'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    85
    ' and other non-member participants, when they apply to contribute'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    86
    ' to the organization.')
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
  contrib_disappears = db.TextProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    89
    verbose_text=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    90
      'What is your plan for dealing with disappearing contributors?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    91
  contrib_disappears.help_text = ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    92
    'Contributors include students and other non-member participants.')
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
  member_disappears = db.TextProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    95
    verbose_text=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    96
      'What is your plan for dealing with disappearing members?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    97
  member_disappears = ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    98
    'Members include mentors, admininstrators, and the like.')
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
  encourage_contribs = db.TextProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   101
    verbose_text=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   102
      'What steps will you take to encourage contributors to interact with'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   103
      ' your community before, during, and after the program?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   104
  encourage_contribs.help_text = contrib_disappears.help_text
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   105
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   106
  continued_contribs = db.TextProperty(required=True,
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   107
    verbose_text=ugettext_lazy(
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   108
      'What will you do to ensure that your accepted contributors stick'
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   109
      ' with the project after the program concludes?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
   110
  continued_contribs.help_text = contrib_disappears.help_text