71 |
71 |
72 params = dicts.merge(params, new_params, sub_merge=True) |
72 params = dicts.merge(params, new_params, sub_merge=True) |
73 |
73 |
74 super(View, self).__init__(params=params) |
74 super(View, self).__init__(params=params) |
75 |
75 |
76 # TODO: work on grade activation |
|
77 def activate(self, request, **kwargs): |
|
78 """This is a hack to support the 'Enable grades' button. |
|
79 """ |
|
80 self.activateGrades(request) |
|
81 redirect_path = request.path.replace('/activate/', '/edit/') + ( |
|
82 '?activate=1') |
|
83 return http.HttpResponseRedirect(redirect_path) |
|
84 |
|
85 def activateGrades(self, request, **kwargs): |
|
86 """Updates SurveyRecord's grades for a given Survey. |
|
87 """ |
|
88 survey_key_name = survey_logic.getKeyNameFromPath(request.path) |
|
89 survey = Survey.get_by_key_name(survey_key_name) |
|
90 survey_logic.activateGrades(survey) |
|
91 return |
|
92 |
|
93 def _getSurveyTakeForm(self, survey, record, params, post_dict=None): |
76 def _getSurveyTakeForm(self, survey, record, params, post_dict=None): |
94 """Returns the specific SurveyTakeForm needed for the take view. |
77 """Returns the specific SurveyTakeForm needed for the take view. |
95 |
78 |
96 Args: |
79 Args: |
97 survey: a Survey entity |
80 survey: a Survey entity |