# HG changeset patch # User Lennard de Rijk # Date 1246276884 -7200 # Node ID 6276c3340c30c262c34ca1d99fe4270c55c5dae1 # Parent 2e86dbd479079e0bfc0b89dbd08e81c7b700aa56 Separated two survey types out of the main survey model. These models are ProjectSurvey and GradingProjectSurvey. diff -r 2e86dbd47907 -r 6276c3340c30 app/soc/logic/models/survey.py --- a/app/soc/logic/models/survey.py Mon Jun 29 13:50:03 2009 +0200 +++ b/app/soc/logic/models/survey.py Mon Jun 29 14:01:24 2009 +0200 @@ -35,8 +35,8 @@ from soc.models.program import Program from soc.models import student_project from soc.models.survey import Survey -from soc.models.survey import ProjectSurvey -from soc.models.survey import GradingProjectSurvey +from soc.models.grading_project_survey import GradingProjectSurvey +from soc.models.project_survey import ProjectSurvey from soc.models.survey import SurveyContent from soc.models.survey_record import SurveyRecord from soc.models.survey_record_group import SurveyRecordGroup diff -r 2e86dbd47907 -r 6276c3340c30 app/soc/models/grading_project_survey.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/models/grading_project_survey.py Mon Jun 29 14:01:24 2009 +0200 @@ -0,0 +1,40 @@ +#!/usr/bin/python2.5 +# +# Copyright 2009 the Melange authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This module contains the GradingProjectSurvey model. +""" + +__authors__ = [ + '"Daniel Diniz" ', + '"Lennard de Rijk" ', +] + + +from soc.models.project_survey import ProjectSurvey + + +class GradingProjectSurvey(ProjectSurvey): + """Survey for Mentors for each of their StudentProjects. + """ + + def __init__(self, *args, **kwargs): + super(GradingProjectSurvey, self).__init__(*args, **kwargs) + self.taking_access = 'mentor' + + def getRecords(self): + """Returns all GradingProjectSurveyRecords belonging to this survey. + """ + return self.grading_survey_records diff -r 2e86dbd47907 -r 6276c3340c30 app/soc/models/project_survey.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/models/project_survey.py Mon Jun 29 14:01:24 2009 +0200 @@ -0,0 +1,42 @@ +#!/usr/bin/python2.5 +# +# Copyright 2009 the Melange authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This module contains the ProjectSurvey model. +""" + +__authors__ = [ + '"Daniel Diniz" ', + '"Lennard de Rijk" ', +] + + +from soc.models.survey import Survey + + +class ProjectSurvey(Survey): + """Survey for Students that have a StudentProject. + """ + + def __init__(self, *args, **kwargs): + super(ProjectSurvey, self).__init__(*args, **kwargs) + self.prefix = 'program' + self.taking_access = 'student' + self.scope = Program.get_by_key_name(self.scope_path) + + def getRecords(self): + """Returns all ProjectSurveyRecords belonging to this survey. + """ + return self.project_survey_records diff -r 2e86dbd47907 -r 6276c3340c30 app/soc/models/survey.py --- a/app/soc/models/survey.py Mon Jun 29 13:50:03 2009 +0200 +++ b/app/soc/models/survey.py Mon Jun 29 14:01:24 2009 +0200 @@ -165,33 +165,3 @@ """Returns all SurveyRecords belonging to this survey. """ return self.survey_records - - -class ProjectSurvey(Survey): - """Survey for Students that have a StudentProject. - """ - - def __init__(self, *args, **kwargs): - super(ProjectSurvey, self).__init__(*args, **kwargs) - self.prefix = 'program' - self.taking_access = 'student' - self.scope = Program.get_by_key_name(self.scope_path) - - def getRecords(self): - """Returns all ProjectSurveyRecords belonging to this survey. - """ - return self.project_survey_records - - -class GradingProjectSurvey(ProjectSurvey): - """Survey for Mentors that have a StudentProject. - """ - - def __init__(self, *args, **kwargs): - super(GradingProjectSurvey, self).__init__(*args, **kwargs) - self.taking_access = 'mentor' - - def getRecords(self): - """Returns all GradingProjectSurveyRecords belonging to this survey. - """ - return self.grading_survey_records diff -r 2e86dbd47907 -r 6276c3340c30 app/soc/models/survey_record.py --- a/app/soc/models/survey_record.py Mon Jun 29 13:50:03 2009 +0200 +++ b/app/soc/models/survey_record.py Mon Jun 29 14:01:24 2009 +0200 @@ -33,8 +33,8 @@ from django.utils.translation import ugettext from soc.models.survey import Survey -from soc.models.survey import GradingProjectSurvey -from soc.models.survey import ProjectSurvey +from soc.models.grading_project_survey import GradingProjectSurvey +from soc.models.project_survey import ProjectSurvey import soc.models.student_project import soc.models.user