app/soc/models/project_survey_record.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Tue, 15 Sep 2009 22:01:16 +0200
changeset 2926 effa1cfb3607
parent 2658 34b414a80d42
permissions -rw-r--r--
Added school_type and grade property to Student model. A GAE Task will be provided to update the existing entities in a later commit. Reviewed by: Lennard de Rijk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2446
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     2
#
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     4
#
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     8
#
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    10
#
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    16
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    17
"""ProjectSurveyRecord allows linking two result sets by StudentProject.
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    18
"""
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    19
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    20
__authors__ = [
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    21
  '"Daniel Diniz" <ajaksu@gmail.com>',
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    22
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    23
]
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    24
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    25
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    26
from google.appengine.ext import db
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    27
2591
6c57c482f913 Add Organization reference property to ProjectSurveyRecord.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2588
diff changeset
    28
from soc.models.organization import Organization
2446
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    29
from soc.models.survey_record import SurveyRecord
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    30
from soc.models.project_survey import ProjectSurvey
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    31
import soc.models.student_project
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    32
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    33
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    34
class ProjectSurveyRecord(SurveyRecord):
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    35
  """Record linked to a Project, enabling to store which Projects had their
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    36
  Survey done.
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    37
  """
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    38
0cf8f034f52d Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    39
  #: Reference to the Project that this record belongs to.
2588
db306bbda381 Indention fixes and adding "reference_class=" in ReferenceProperty params.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2493
diff changeset
    40
  project = db.ReferenceProperty(
db306bbda381 Indention fixes and adding "reference_class=" in ReferenceProperty params.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2493
diff changeset
    41
      reference_class=soc.models.student_project.StudentProject,
db306bbda381 Indention fixes and adding "reference_class=" in ReferenceProperty params.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2493
diff changeset
    42
      required=True, collection_name="survey_records")
2658
34b414a80d42 Several style fixes and code cleaning for surveys.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2591
diff changeset
    43
2591
6c57c482f913 Add Organization reference property to ProjectSurveyRecord.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2588
diff changeset
    44
  #: A many:1 relationship associating ProjectSurveyRecords 
6c57c482f913 Add Organization reference property to ProjectSurveyRecord.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2588
diff changeset
    45
  #: with specific Organization. The back-reference in the 
6c57c482f913 Add Organization reference property to ProjectSurveyRecord.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2588
diff changeset
    46
  #: Organization model is a Query named 'survey_records'.
6c57c482f913 Add Organization reference property to ProjectSurveyRecord.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2588
diff changeset
    47
  org = db.ReferenceProperty(
6c57c482f913 Add Organization reference property to ProjectSurveyRecord.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2588
diff changeset
    48
      reference_class=Organization, 
6c57c482f913 Add Organization reference property to ProjectSurveyRecord.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2588
diff changeset
    49
      required=False, collection_name='survey_records')