app/soc/models/grading_survey_group.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Sat, 11 Jul 2009 19:54:23 +0200
changeset 2591 6c57c482f913
parent 2588 db306bbda381
permissions -rw-r--r--
Add Organization reference property to ProjectSurveyRecord. Also update ProjectSurvey view _takePost method to set this property everytime survey is taken.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2567
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     2
#
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     4
#
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     8
#
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    10
#
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    16
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    17
"""GradingSurveyGroup has the ability to link a GradingProjectSurvey to a
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    18
ProjectSurvey for evaluation purposes.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    19
"""
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    20
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    21
__authors__ = [
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    22
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    23
]
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    24
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    25
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    26
from google.appengine.ext import db
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    27
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    28
from django.utils.translation import ugettext
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    29
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    30
from soc.models import linkable
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    31
from soc.models.grading_project_survey import GradingProjectSurvey
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    32
from soc.models.project_survey import ProjectSurvey
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    33
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    34
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    35
class GradingSurveyGroup(linkable.Linkable):
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    36
  """The GradingSurveyGroups links a ProjectSurvey with a GradingProjectSurvey.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    37
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    38
  The purpose of this model is to be able to link two different types of
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    39
  Surveys together so that a decision can be made about whether or not a
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    40
  Student has passed the evaluation. This model will link the Surveys together
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    41
  a GradingRecord will link the SurveyRecords.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    42
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    43
  Since this model is only used in GSoC style programs the scope will be set to
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    44
  a Program entity. The link_id can be auto-generated.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    45
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    46
  A GradingSurvey group can also work with only a GradingProjectSurvey defined.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    47
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    48
  The GradingSurveyGroup can have several GradingRecords attached to it. These
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    49
  will contain matching SurveyRecords for the surveys set in this group, of
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    50
  course only if they are filled in.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    51
  """
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    52
2579
0d4ffe73a019 Added name property to GradingSurveyGroup.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2567
diff changeset
    53
  #: Name to give to this group for easy human-readable identification.
0d4ffe73a019 Added name property to GradingSurveyGroup.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2567
diff changeset
    54
  name = db.StringProperty(
0d4ffe73a019 Added name property to GradingSurveyGroup.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2567
diff changeset
    55
      required=True, verbose_name=ugettext('Survey Group Name'))
0d4ffe73a019 Added name property to GradingSurveyGroup.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2567
diff changeset
    56
2567
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    57
  #: GradingProjectSurvey which belongs to this group.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    58
  grading_survey = db.ReferenceProperty(
2588
db306bbda381 Indention fixes and adding "reference_class=" in ReferenceProperty params.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2579
diff changeset
    59
      reference_class=GradingProjectSurvey, required=True,
2567
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    60
      collection_name='grading_survey_groups')
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    61
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    62
  #: non-required ProjectSurvey that belongs to this group.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    63
  student_survey = db.ReferenceProperty(
2588
db306bbda381 Indention fixes and adding "reference_class=" in ReferenceProperty params.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2579
diff changeset
    64
      reference_class=ProjectSurvey, required=False,
2567
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    65
      collection_name='project_survey_groups')
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    66
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    67
  #: DateTime when the last GradingRecord update was started for this group.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    68
  last_update_started = db.DateTimeProperty(
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    69
      verbose_name=ugettext('Last Record update started'))
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    70
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    71
  #: DateTime when the last GradingRecord update was completed for this group.
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    72
  last_update_complete = db.DateTimeProperty(
0162efa63bb6 Added skeleton models for GradingSurveyGroup and Records.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    73
      verbose_name=ugettext('Last Record update completed'))