app/soc/models/survey.py
author Lennard de Rijk <ljvderijk@gmail.com>
Mon, 24 Aug 2009 18:44:41 +0200
changeset 2793 8c88226b27e7
parent 2792 14a62fcf4e02
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:
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
2763
80d625f78176 Added base Model for Expando models.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2588
diff changeset
    34
from soc.models.expando_base import ExpandoBase
80d625f78176 Added base Model for Expando models.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2588
diff changeset
    35
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    36
import soc.models.work
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    37
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    38
2501
d612b48e6e12 Added Survey From Field validation.
Daniel Diniz <ajaksu@gmail.com>
parents: 2493
diff changeset
    39
COMMENT_PREFIX = 'comment_for_'
d612b48e6e12 Added Survey From Field validation.
Daniel Diniz <ajaksu@gmail.com>
parents: 2493
diff changeset
    40
d612b48e6e12 Added Survey From Field validation.
Daniel Diniz <ajaksu@gmail.com>
parents: 2493
diff changeset
    41
2763
80d625f78176 Added base Model for Expando models.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2588
diff changeset
    42
class SurveyContent(ExpandoBase):
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    43
  """Fields (questions) and schema representation of a Survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    44
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    45
  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
    46
  values are set by the survey creator as survey fields.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    47
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    48
    schema: A dictionary (as text) storing, for each field:
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    49
      - type
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    50
      - index
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    51
      - order (for choice questions)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    52
      - render (for choice questions)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    53
      - question (free form text question, used as label)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    54
  """
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    55
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    56
  #: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
    57
  schema = db.TextProperty()
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    58
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    59
  #: Fields storing the created on and last modified on dates.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    60
  created = db.DateTimeProperty(auto_now_add=True)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    61
  modified = db.DateTimeProperty(auto_now=True)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    62
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    63
  def getSurveyOrder(self):
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    64
    """Make survey questions always appear in the same (creation) order.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    65
    """
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    66
    survey_order = {}
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    67
    schema = eval(self.schema)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    68
    for property in self.dynamic_properties():
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    69
      # map out the order of the survey fields
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    70
      index = schema[property]["index"]
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    71
      if index not in survey_order:
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    72
        survey_order[index] = property
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    73
      else:
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    74
        # Handle duplicated indexes
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    75
        survey_order[max(survey_order) + 1] = property
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    76
    return survey_order
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    77
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    78
  def orderedProperties(self):
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    79
    """Helper for View.get_fields(), keep field order.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    80
    """
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    81
    properties = []
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    82
    survey_order = self.getSurveyOrder().items()
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    83
    for position,key in survey_order:
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    84
      properties.insert(position, key)
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    85
    return properties
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    86
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    87
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    88
class Survey(soc.models.work.Work):
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    89
  """Model of a Survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    90
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    91
  This model describes meta-information and permissions.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    92
  The actual questions of the survey are contained
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    93
  in the SurveyContent entity.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    94
  """
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    95
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    96
  URL_NAME = 'survey'
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    97
  # euphemisms like "student" and "mentor" should be used if possible
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    98
  SURVEY_ACCESS = ['admin', 'restricted', 'member', 'user']
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
    99
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   100
  # these are GSoC specific, so eventually we can subclass this
2792
14a62fcf4e02 Added org taking access to Surveys.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2763
diff changeset
   101
  SURVEY_TAKING_ACCESS = ['student', 'mentor', 'org_admin', 'org', 'user']
14a62fcf4e02 Added org taking access to Surveys.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2763
diff changeset
   102
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   103
  GRADE_OPTIONS = {'midterm':['mid_term_passed', 'mid_term_failed'],
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   104
                   'final':['final_passed', 'final_failed'],
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   105
                   'N/A':[] }
2442
dd1f94c3594c Start on adding ProjectSurvey and GradingProjectSurvey.
Daniel Diniz <ajaksu@gmail.com>
parents: 2440
diff changeset
   106
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   107
  prefix = db.StringProperty(default='program', required=True,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   108
      choices=['site', 'club', 'sponsor', 'program', 'org', 'user'],
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   109
      verbose_name=ugettext('Prefix'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   110
  prefix.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   111
      'Indicates the prefix of the survey,'
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   112
      ' determines which access scheme is used.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   113
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   114
  #: Field storing the required access to read this survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   115
  read_access = db.StringProperty(default='restricted', required=True,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   116
      choices=SURVEY_ACCESS,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   117
      verbose_name=ugettext('Survey Read Access'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   118
  read_access.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   119
      'Indicates who can read the results of this survey.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   120
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   121
  #: Field storing the required access to write to this survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   122
  write_access = db.StringProperty(default='admin', required=True,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   123
      choices=SURVEY_ACCESS,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   124
      verbose_name=ugettext('Survey Write Access'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   125
  write_access.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   126
      'Indicates who can edit this survey.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   127
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   128
  #: Field storing the required access to write to this survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   129
  taking_access = db.StringProperty(default='student', required=True,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   130
      choices=SURVEY_TAKING_ACCESS,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   131
      verbose_name=ugettext('Survey Taking Access'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   132
  taking_access.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   133
      'Indicates who can take this survey. '
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   134
      'Student/Mentor options are for Midterms and Finals.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   135
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   136
  #: 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
   137
  #: the sidebar menu (and possibly elsewhere); FAQs, Terms of Service,
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   138
  #: and the like are examples of "featured" survey.
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   139
  is_featured = db.BooleanProperty(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   140
      verbose_name=ugettext('Is Featured'))
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   141
  is_featured.help_text = ugettext(
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   142
      '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
   143
      ' in the sidebar menu.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   144
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   145
  #: 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
   146
  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
   147
  survey_start.help_text = ugettext(
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   148
      'Indicates a date before which this survey'
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   149
      ' cannot be taken or displayed.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   150
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   151
  #: 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
   152
  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
   153
  survey_end.help_text = ugettext(
2428
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   154
      'Indicates a date after which this survey'
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   155
      ' cannot be taken.')
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   156
8ca9f32d3fc4 Added Survey and SurveyContent model.
James Levy <jamesalexanderlevy@gmail.com>
parents:
diff changeset
   157
  #: 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
   158
  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
   159
                                        collection_name="survey_parent")