equal
deleted
inserted
replaced
495 context['entity'] = entity |
495 context['entity'] = entity |
496 |
496 |
497 # try to get an existing SurveyRecord for the current user |
497 # try to get an existing SurveyRecord for the current user |
498 survey_record = self._getSurveyRecordFor(entity, request, params) |
498 survey_record = self._getSurveyRecordFor(entity, request, params) |
499 |
499 |
500 # create an instance of SurveyTakeForm to use |
500 # get an instance of SurveyTakeForm to use |
501 survey_form = surveys.SurveyTakeForm(survey_content=entity.survey_content, |
501 survey_form = self._getSurveyTakeForm(entity, survey_record, params) |
502 survey_logic=self._params['logic']) |
|
503 |
502 |
504 # fill context with the survey_form and additional information |
503 # fill context with the survey_form and additional information |
505 context['survey_form'] = survey_form |
504 context['survey_form'] = survey_form |
506 self.setHelpAndStatus(context, entity, survey_record) |
505 self.setHelpAndStatus(context, entity, survey_record) |
507 |
506 |
532 |
531 |
533 filter = {'survey': survey, |
532 filter = {'survey': survey, |
534 'user': user_entity} |
533 'user': user_entity} |
535 |
534 |
536 return record_logic.getForFields(filter, unique=True) |
535 return record_logic.getForFields(filter, unique=True) |
|
536 |
|
537 def _getSurveyTakeForm(self, survey, record, params): |
|
538 """Returns the specific SurveyTakeForm needed for the take view. |
|
539 |
|
540 Args: |
|
541 survey: a Survey entity |
|
542 record: a SurveyRecord instance if any exist |
|
543 params: the params dict for the requesting View |
|
544 |
|
545 Returns: |
|
546 An instance of SurveyTakeForm that can be used to take a Survey. |
|
547 """ |
|
548 |
|
549 return surveys.SurveyTakeForm(survey_content=survey.survey_content, |
|
550 survey_logic=params['logic']) |
537 |
551 |
538 def takeGet(self, request, template, context, params, survey_form, entity, |
552 def takeGet(self, request, template, context, params, survey_form, entity, |
539 record, **kwargs): |
553 record, **kwargs): |
540 """Handles the GET request for the Survey's take page. |
554 """Handles the GET request for the Survey's take page. |
541 |
555 |