app/soc/models/org_app.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 19 Feb 2009 22:51:24 +0000
changeset 1407 423425ac79f5
parent 1404 3baec5ce9911
child 1562 0e1a93e0c54d
permissions -rw-r--r--
Fixed copy/paste fail 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
#
1307
091a21cf3627 Update the copyright notice for 2009.
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1272
diff changeset
     3
# Copyright 2009 the Melange authors.
774
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
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 936
diff changeset
    26
from django.utils.translation import ugettext
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    27
1403
7ffce7c14da6 Make org_app use the new licenses set
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
    28
from soc.models import licenses
7ffce7c14da6 Make org_app use the new licenses set
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
    29
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    30
import soc.models.document
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    31
import soc.models.group_app
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    32
import soc.models.user
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    33
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    34
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    35
class OrgApplication(soc.models.group_app.GroupApplication):
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    36
  """Specialized questions for the Organization application.
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
  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
    39
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    40
  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
    41
  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
    42
  (converted) to their new representations in the Datastore.
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    43
  """
795
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    44
  
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    45
  prior_participation = db.TextProperty(required=False, verbose_name=ugettext(
795
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    46
      'Has your group participated previously?'
8914adaa93a7 Added control fields to group_app.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 774
diff changeset
    47
      ' 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
    48
      ' and failures.'))
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    49
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    50
  prior_application = db.TextProperty(required=False, verbose_name=ugettext(
795
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
  
1403
7ffce7c14da6 Make org_app use the new licenses set
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
    54
  license_name = db.StringProperty(required=True, choices=licenses.LICENSES,
7ffce7c14da6 Make org_app use the new licenses set
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
    55
      verbose_name=ugettext('What license does your organization use?'))
1404
3baec5ce9911 Added a link to the official OSI licenses list
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1403
diff changeset
    56
  license_name.example_text=ugettext('See '
3baec5ce9911 Added a link to the official OSI licenses list
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1403
diff changeset
    57
      '<a href="http://www.opensource.org/licenses/alphabetical"> the official list</a>.')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    58
 
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    59
  ideas = db.LinkProperty(required=True, verbose_name=ugettext(
1231
ab19a8ad375f Added some help_text and clarifications to org_app model fields.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1230
diff changeset
    60
      'What is the URL to the ideas list of your organization?'))
ab19a8ad375f Added some help_text and clarifications to org_app model fields.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1230
diff changeset
    61
  ideas.help_text = ugettext('For instance a link to a Melange public '
ab19a8ad375f Added some help_text and clarifications to org_app model fields.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1230
diff changeset
    62
      'document or some other URL')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    63
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    64
  dev_mailing_list = db.StringProperty(required=False, verbose_name=ugettext(
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    65
      'What is the main development mailing list for your group?'))
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 936
diff changeset
    66
  dev_mailing_list.help_text = ugettext(
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    67
      'Mailing list email address, URL to sign-up page, etc.')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    68
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    69
  contrib_template = db.LinkProperty(required=False, verbose_name=ugettext(
1231
ab19a8ad375f Added some help_text and clarifications to org_app model fields.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1230
diff changeset
    70
      'What is the URL to the application template would you like contributors'
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    71
      ' to your organization to use.'))
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 936
diff changeset
    72
  contrib_template.help_text = ugettext(
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    73
      'This template can be used by contributors, such as students'
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    74
      ' and other non-member participants, when they apply to contribute'
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    75
      ' to the organization.')
1231
ab19a8ad375f Added some help_text and clarifications to org_app model fields.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1230
diff changeset
    76
  contrib_template.help_text = ugettext('For instance a link to a Melange '
ab19a8ad375f Added some help_text and clarifications to org_app model fields.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1230
diff changeset
    77
      'public document or some other URL')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    78
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    79
  contrib_disappears = db.TextProperty(required=True, verbose_name=ugettext(
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    80
      'What is your plan for dealing with disappearing contributors?'))
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 936
diff changeset
    81
  contrib_disappears.help_text = ugettext(
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    82
      'Contributors include students and other non-member participants.')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    83
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    84
  member_disappears = db.TextProperty(required=True, verbose_name=ugettext(
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    85
      'What is your plan for dealing with disappearing members?'))
1149
c8d2bd7be24f Changed some errors in the org_app model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 970
diff changeset
    86
  member_disappears.help_text = ugettext(
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    87
      'Members include mentors, administrators, and the like.')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    88
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    89
  encourage_contribs = db.TextProperty(required=True, verbose_name=ugettext(
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    90
      '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
    91
      ' your community before, during, and after the program?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    92
  encourage_contribs.help_text = contrib_disappears.help_text
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    93
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    94
  continued_contribs = db.TextProperty(required=True, verbose_name=ugettext(
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    95
      '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
    96
      ' with the project after the program concludes?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    97
  continued_contribs.help_text = contrib_disappears.help_text
1272
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
    98
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
    99
  #: field storing whether the User has agreed to the site-wide Terms of Service.
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
   100
  #: (Not a required field because the Terms of Service might not be present
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
   101
  #: when the first User profile is created when bootstrapping the site.)
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
   102
  agreed_to_admin_agreement = db.BooleanProperty(required=False, default=False,
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
   103
      verbose_name=ugettext('I Agree to the Admin Agreement'))
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
   104
  agreed_to_admin_agreement.help_text = ugettext(
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
   105
      'Indicates whether the user agreed to the Admin Agreement.')