app/soc/modules/ghop/models/program.py
author Daniel Diniz <ajaksu@gmail.com>
Thu, 09 Jul 2009 10:39:30 +0200
changeset 2576 7a1138f8a0e2
parent 2408 726183fad650
child 2716 9921ac952f13
permissions -rw-r--r--
Removed results list from Survey edit. Some changes to the Survey Result page have also been made, however the results viewer and the CSV export are not working properly in that View. Reviewd by: Lennard de Rijk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     2
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     4
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     8
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    10
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    16
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    17
"""This module contains the GHOP specific Program Model.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    18
"""
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    19
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    20
__authors__ = [
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    21
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    22
]
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    23
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    24
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    25
from google.appengine.ext import db
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    26
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    27
from django.utils.translation import ugettext
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    28
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    29
import soc.models.program
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    30
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    31
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    32
class GHOPProgram(soc.models.program.Program):
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    33
  """GHOP Program model extends the basic Program model.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    34
  """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    35
2406
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    36
  #: Property that contains the minimum age of a student allowed to
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    37
  #: participate
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    38
  student_min_age = db.IntegerProperty(
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    39
      required=True, verbose_name=ugettext('Student minimum age'))
2408
726183fad650 Added group attribute to each GHOPProgram property so it is grouped on edit/create forms.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2406
diff changeset
    40
  student_min_age.group = ugettext('Contest Rules')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    41
  student_min_age.help_text = ugettext(
2406
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    42
      'Minimum age of the student to sign-up in years.')
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    43
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    44
  #: Property that contains the date as of which above student
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    45
  #: minimum age requirement holds. This is a DateTimeProperty because
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    46
  #: programs might run in a different timezone then the Appengine Server
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    47
  #: is running on.
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    48
  student_min_age_as_of = db.DateTimeProperty(
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    49
      required=True, verbose_name=ugettext('Minimum age as of'))
2408
726183fad650 Added group attribute to each GHOPProgram property so it is grouped on edit/create forms.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2406
diff changeset
    50
  student_min_age_as_of.group = ugettext('Contest Rules')
2406
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    51
  student_min_age_as_of.help_text = ugettext(
6f966e1a80bc Changed the property that holds the minimum age required for Students to participate in a GHOP based program.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2397
diff changeset
    52
      'Date as of which the student minimum age requirement holds.')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    53
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    54
  #: Required property containing the number of Tasks Students can work
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    55
  #: on simultaneously. For GHOP it is 1
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    56
  nr_simultaneous_tasks = db.IntegerProperty(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    57
      required=True, default=1, 
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    58
      verbose_name=ugettext('Simultaneous tasks'))
2408
726183fad650 Added group attribute to each GHOPProgram property so it is grouped on edit/create forms.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2406
diff changeset
    59
  nr_simultaneous_tasks.group = ugettext('Contest Rules')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    60
  nr_simultaneous_tasks.help_text = ugettext(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    61
      'Number of tasks students can work on simultaneously in the program.')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    62
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    63
  #: Property containing the number of winners per Organization
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    64
  nr_winners = db.IntegerProperty(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    65
      required=True, default=0,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    66
      verbose_name=ugettext('Winners per organization'))
2408
726183fad650 Added group attribute to each GHOPProgram property so it is grouped on edit/create forms.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2406
diff changeset
    67
  nr_winners.group = ugettext('Prize Information')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    68
  nr_winners.help_text = ugettext(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    69
      'Number of winners an organization can announce.')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    70
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    71
  #: Property containing the number of runner ups per Organization
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    72
  nr_runnerups = db.IntegerProperty(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    73
      required=True, default=0,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    74
      verbose_name=ugettext('Runner-ups per organization'))
2408
726183fad650 Added group attribute to each GHOPProgram property so it is grouped on edit/create forms.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2406
diff changeset
    75
  nr_runnerups.group = ugettext('Prize Information')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    76
  nr_runnerups.help_text = ugettext(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    77
      'Number of runner-ups an organization can announce.')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    78
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    79
  #: A list of difficulty levels that can be assigned for each Task created
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    80
  task_difficulties = db.StringListProperty(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    81
      required=True, default=[''],
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    82
      verbose_name=ugettext('Difficulty levels'))
2408
726183fad650 Added group attribute to each GHOPProgram property so it is grouped on edit/create forms.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2406
diff changeset
    83
  task_difficulties.group = ugettext('Task Settings')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    84
  task_difficulties.help_text = ugettext(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    85
      'List all the difficulty levels that can be assigned to a task.')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    86
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    87
  #: A list of task types that a Task can belong to
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    88
  task_types = db.StringListProperty(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    89
      required=True, default=['Any'],
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    90
      verbose_name=ugettext('Task Types'))
2408
726183fad650 Added group attribute to each GHOPProgram property so it is grouped on edit/create forms.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2406
diff changeset
    91
  task_types.group = ugettext('Task Settings')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    92
  task_types.help_text = ugettext(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    93
      'List all the types a task can be in.')