Add Organization reference property to ProjectSurveyRecord.
Also update ProjectSurvey view _takePost method to set this property everytime survey is taken.
--- a/app/soc/models/project_survey_record.py Sat Jul 11 19:37:26 2009 +0200
+++ b/app/soc/models/project_survey_record.py Sat Jul 11 19:54:23 2009 +0200
@@ -25,6 +25,7 @@
from google.appengine.ext import db
+from soc.models.organization import Organization
from soc.models.survey_record import SurveyRecord
from soc.models.project_survey import ProjectSurvey
import soc.models.student_project
@@ -39,3 +40,10 @@
project = db.ReferenceProperty(
reference_class=soc.models.student_project.StudentProject,
required=True, collection_name="survey_records")
+
+ #: A many:1 relationship associating ProjectSurveyRecords
+ #: with specific Organization. The back-reference in the
+ #: Organization model is a Query named 'survey_records'.
+ org = db.ReferenceProperty(
+ reference_class=Organization,
+ required=False, collection_name='survey_records')
--- a/app/soc/views/models/project_survey.py Sat Jul 11 19:37:26 2009 +0200
+++ b/app/soc/views/models/project_survey.py Sat Jul 11 19:54:23 2009 +0200
@@ -147,7 +147,7 @@
project_entity = student_project_logic.getFromKeyName(get_dict['project'])
# update the properties that will be stored with the referenced project
- properties.update(project=project_entity)
+ properties.update(project=project_entity, org=project_entity.scope)
def _constructFilterForProjectSelection(self, survey, params):
"""Returns the filter needed for the Project selection view.