104 return self._selectProjects(request, page_name, params, entity, fields) |
104 return self._selectProjects(request, page_name, params, entity, fields) |
105 |
105 |
106 return super(View, self).take(request, 'any_access', page_name=page_name, |
106 return super(View, self).take(request, 'any_access', page_name=page_name, |
107 params=params, **kwargs) |
107 params=params, **kwargs) |
108 |
108 |
|
109 def _getSurveyRecordFor(self, survey, request, params): |
|
110 """Returns the SurveyRecord for the given Survey and request. |
|
111 |
|
112 This method also take the StudentProject specified as GET param into |
|
113 account when querying for the SurveyRecord. |
|
114 |
|
115 For params see base.View._getSurveyRecordFor(). |
|
116 """ |
|
117 |
|
118 from soc.logic.models.student_project import logic as student_project_logic |
|
119 |
|
120 survey_logic = params['logic'] |
|
121 record_logic = survey_logic.getRecordLogic() |
|
122 |
|
123 user_entity = user_logic.getForCurrentAccount() |
|
124 |
|
125 # get the StudentProject specified in the GET params |
|
126 project_key_name = request.GET['project'] |
|
127 project_entity = student_project_logic.getFromKeyName(project_key_name) |
|
128 |
|
129 filter = {'survey': survey, |
|
130 'user': user_entity, |
|
131 'project': project_entity} |
|
132 |
|
133 return record_logic.getForFields(filter, unique=True) |
|
134 |
109 def _takeGet(self, request, template, context, params, entity, record, |
135 def _takeGet(self, request, template, context, params, entity, record, |
110 **kwargs): |
136 **kwargs): |
111 """Hooking into the view for the take's page GET request. |
137 """Hooking into the view for the take's page GET request. |
112 |
138 |
113 For params see survey.View._takeGet(). |
139 For params see survey.View._takeGet(). |