app/soc/models/org_app.py
author Lennard de Rijk <ljvderijk@gmail.com>
Mon, 24 Aug 2009 18:44:41 +0200
changeset 2793 8c88226b27e7
parent 1871 091118f6e886
permissions -rw-r--r--
Set default taking access for GradingProjectSurvey to org. This will allow Mentors and Org Admins to take GradingProjectSurveys in case that an Org Admin has no Mentor roles.
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
  """
1562
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1404
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'
1869
9552c2499201 Verbiage fix in org app
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1628
diff changeset
    52
      ' the past?  If so, for what programs/initiatives?'
9552c2499201 Verbiage fix in org app
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1628
diff changeset
    53
      ' (e.g. Google Summer of Code 2007)'))
1562
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1404
diff changeset
    54
1403
7ffce7c14da6 Make org_app use the new licenses set
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
    55
  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
    56
      verbose_name=ugettext('What license does your organization use?'))
1628
276e8e72c874 Fix too long lines in soc.models.org_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1566
diff changeset
    57
  license_name.example_text = ugettext('See '
276e8e72c874 Fix too long lines in soc.models.org_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1566
diff changeset
    58
      '<a href="http://www.opensource.org/licenses/alphabetical"> '
276e8e72c874 Fix too long lines in soc.models.org_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1566
diff changeset
    59
      'the official list</a>.')
1562
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1404
diff changeset
    60
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    61
  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
    62
      '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
    63
  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
    64
      'document or some other URL')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    65
1562
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1404
diff changeset
    66
  dev_mailing_list = db.StringProperty(required=True, verbose_name=ugettext(
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    67
      '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
    68
  dev_mailing_list.help_text = ugettext(
1562
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1404
diff changeset
    69
    'Mailing list email address, URL to sign-up page, etc. If a mailing '
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1404
diff changeset
    70
    'list is not used please specify another method of communication used '
0e1a93e0c54d Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1404
diff changeset
    71
    'within the group.')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    72
1566
5388270fb363 contrib template in org_app is now a TextProperty.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1562
diff changeset
    73
  contrib_template = db.TextProperty(required=False, verbose_name=ugettext(
5388270fb363 contrib template in org_app is now a TextProperty.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1562
diff changeset
    74
      'What is the application template you would like contributors'
1871
091118f6e886 Replaced a '.' with '?' in org app
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1869
diff changeset
    75
      ' to your organization to use?'))
970
8b5611d5b053 Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents: 936
diff changeset
    76
  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
    77
      '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
    78
      ' 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
    79
      ' to the organization.')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    80
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    81
  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
    82
      '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
    83
  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
    84
      '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
    85
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    86
  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
    87
      '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
    88
  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
    89
      'Members include mentors, administrators, and the like.')
774
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    90
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    91
  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
    92
      '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
    93
      ' your community before, during, and after the program?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    94
  encourage_contribs.help_text = contrib_disappears.help_text
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    95
1230
b1b1897e4df1 Cleanup in org_app and replace ReferenceProperty with LinkProperty
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1229
diff changeset
    96
  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
    97
      '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
    98
      ' with the project after the program concludes?'))
88a827a9b614 Add hard-coded GroupApplication and OrgApplication Models.
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    99
  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
   100
1628
276e8e72c874 Fix too long lines in soc.models.org_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1566
diff changeset
   101
  #: field storing whether the User has agreed to the site-wide 
276e8e72c874 Fix too long lines in soc.models.org_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1566
diff changeset
   102
  #: Terms of Service. (Not a required field because the Terms of 
276e8e72c874 Fix too long lines in soc.models.org_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1566
diff changeset
   103
  #: Service might not be present when the first User profile is 
276e8e72c874 Fix too long lines in soc.models.org_app module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1566
diff changeset
   104
  #: created when bootstrapping the site.)
1272
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
   105
  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
   106
      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
   107
  agreed_to_admin_agreement.help_text = ugettext(
c17e47db4875 Added an agreed_to_admin_agreement property
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1231
diff changeset
   108
      'Indicates whether the user agreed to the Admin Agreement.')