app/soc/models/survey.py
author Augie Fackler <durin42@gmail.com>
Sun, 12 Jul 2009 11:46:36 -0500
changeset 2613 169d69967431
parent 2588 db306bbda381
child 2763 80d625f78176
permissions -rw-r--r--
buildout.cfg: We require nose as well for tests.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
     2
#
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
     4
#
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
     8
#
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    10
#
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    16
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    17
"""This module contains the Survey models.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    18
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    19
Survey describes meta-information and permissions.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    20
SurveyContent contains the fields (questions) and their metadata.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    21
"""
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    22
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    23
__authors__ = [
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    24
  '"Daniel Diniz" <ajaksu@gmail.com>',
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    25
  '"James Levy" <jamesalexanderlevy@gmail.com>',
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    26
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    27
]
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    28
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    29
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    30
from google.appengine.ext import db
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    31
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    32
from django.utils.translation import ugettext
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    33
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    34
import soc.models.work
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    35
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    36
2501
d612b48e6e12 Added Survey From Field validation.
Daniel Diniz <ajaksu@gmail.com>
parents: 2493
diff changeset
    37
COMMENT_PREFIX = 'comment_for_'
d612b48e6e12 Added Survey From Field validation.
Daniel Diniz <ajaksu@gmail.com>
parents: 2493
diff changeset
    38
d612b48e6e12 Added Survey From Field validation.
Daniel Diniz <ajaksu@gmail.com>
parents: 2493
diff changeset
    39
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    40
class SurveyContent(db.Expando):
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    41
  """Fields (questions) and schema representation of a Survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    42
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    43
  Each survey content entity consists of properties where names and default
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    44
  values are set by the survey creator as survey fields.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    45
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    46
    schema: A dictionary (as text) storing, for each field:
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    47
      - type
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    48
      - index
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    49
      - order (for choice questions)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    50
      - render (for choice questions)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    51
      - question (free form text question, used as label)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    52
  """
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    53
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    54
  #:Field storing the content of the survey in the form of a dictionary.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    55
  schema = db.TextProperty()
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    56
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    57
  #: Fields storing the created on and last modified on dates.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    58
  created = db.DateTimeProperty(auto_now_add=True)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    59
  modified = db.DateTimeProperty(auto_now=True)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    60
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    61
  def getSurveyOrder(self):
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    62
    """Make survey questions always appear in the same (creation) order.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    63
    """
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    64
    survey_order = {}
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    65
    schema = eval(self.schema)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    66
    for property in self.dynamic_properties():
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    67
      # map out the order of the survey fields
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    68
      index = schema[property]["index"]
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    69
      if index not in survey_order:
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    70
        survey_order[index] = property
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    71
      else:
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    72
        # Handle duplicated indexes
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    73
        survey_order[max(survey_order) + 1] = property
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    74
    return survey_order
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    75
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    76
  def orderedProperties(self):
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    77
    """Helper for View.get_fields(), keep field order.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    78
    """
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    79
    properties = []
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    80
    survey_order = self.getSurveyOrder().items()
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    81
    for position,key in survey_order:
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    82
      properties.insert(position, key)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    83
    return properties
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    84
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    85
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    86
class Survey(soc.models.work.Work):
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    87
  """Model of a Survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    88
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    89
  This model describes meta-information and permissions.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    90
  The actual questions of the survey are contained
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    91
  in the SurveyContent entity.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    92
  """
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    93
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    94
  URL_NAME = 'survey'
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    95
  # euphemisms like "student" and "mentor" should be used if possible
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    96
  SURVEY_ACCESS = ['admin', 'restricted', 'member', 'user']
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    97
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    98
  # these are GSoC specific, so eventually we can subclass this
2501
d612b48e6e12 Added Survey From Field validation.
Daniel Diniz <ajaksu@gmail.com>
parents: 2493
diff changeset
    99
  SURVEY_TAKING_ACCESS = ['student',
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   100
                          'mentor',
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   101
                          'org_admin',
2525
7df431ddcfd3 Remove public role type from SURVEY_TAKING_ACCESS in Survey model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2501
diff changeset
   102
                          'user']
7df431ddcfd3 Remove public role type from SURVEY_TAKING_ACCESS in Survey model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2501
diff changeset
   103
  
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   104
  GRADE_OPTIONS = {'midterm':['mid_term_passed', 'mid_term_failed'],
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   105
                   'final':['final_passed', 'final_failed'],
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   106
                   'N/A':[] }
2442
dd1f94c3594c Start on adding ProjectSurvey and GradingProjectSurvey.
Daniel Diniz <ajaksu@gmail.com>
parents: 2440
diff changeset
   107
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   108
  prefix = db.StringProperty(default='program', required=True,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   109
      choices=['site', 'club', 'sponsor', 'program', 'org', 'user'],
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   110
      verbose_name=ugettext('Prefix'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   111
  prefix.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   112
      'Indicates the prefix of the survey,'
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   113
      ' determines which access scheme is used.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   114
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   115
  #: Field storing the required access to read this survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   116
  read_access = db.StringProperty(default='restricted', required=True,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   117
      choices=SURVEY_ACCESS,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   118
      verbose_name=ugettext('Survey Read Access'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   119
  read_access.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   120
      'Indicates who can read the results of this survey.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   121
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   122
  #: Field storing the required access to write to this survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   123
  write_access = db.StringProperty(default='admin', required=True,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   124
      choices=SURVEY_ACCESS,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   125
      verbose_name=ugettext('Survey Write Access'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   126
  write_access.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   127
      'Indicates who can edit this survey.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   128
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   129
  #: Field storing the required access to write to this survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   130
  taking_access = db.StringProperty(default='student', required=True,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   131
      choices=SURVEY_TAKING_ACCESS,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   132
      verbose_name=ugettext('Survey Taking Access'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   133
  taking_access.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   134
      'Indicates who can take this survey. '
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   135
      'Student/Mentor options are for Midterms and Finals.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   136
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   137
  #: Field storing whether a link to the survey should be featured in
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   138
  #: the sidebar menu (and possibly elsewhere); FAQs, Terms of Service,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   139
  #: and the like are examples of "featured" survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   140
  is_featured = db.BooleanProperty(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   141
      verbose_name=ugettext('Is Featured'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   142
  is_featured.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   143
      'Field used to indicate if a Survey should be featured, for example,'
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   144
      ' in the sidebar menu.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   145
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   146
  #: Date at which the survey becomes available for taking.
2440
05c430d1c147 Renamed opening to survey_start and deadline to survey_end.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2428
diff changeset
   147
  survey_start = db.DateTimeProperty(required=False)
05c430d1c147 Renamed opening to survey_start and deadline to survey_end.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2428
diff changeset
   148
  survey_start.help_text = ugettext(
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   149
      'Indicates a date before which this survey'
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   150
      ' cannot be taken or displayed.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   151
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   152
  #: Deadline for taking survey.
2440
05c430d1c147 Renamed opening to survey_start and deadline to survey_end.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2428
diff changeset
   153
  survey_end = db.DateTimeProperty(required=False)
05c430d1c147 Renamed opening to survey_start and deadline to survey_end.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2428
diff changeset
   154
  survey_end.help_text = ugettext(
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   155
      'Indicates a date after which this survey'
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   156
      ' cannot be taken.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   157
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   158
  #: Referenceproperty that specifies the content of this survey.
2588
db306bbda381 Indention fixes and adding "reference_class=" in ReferenceProperty params.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2525
diff changeset
   159
  survey_content = db.ReferenceProperty(reference_class=SurveyContent,
db306bbda381 Indention fixes and adding "reference_class=" in ReferenceProperty params.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2525
diff changeset
   160
                                        collection_name="survey_parent")