def _process(self): form = self._make_form() if form.validate_on_submit(): submission = self._save_answers(form) if submission.is_anonymous and submission.user: submission.user = None self.survey.anonymous_submissions.append( AnonymousSurveySubmission(user=session.user)) submission.submitted_dt = now_utc() submission.is_submitted = True submission.pending_answers = {} db.session.flush() save_submitted_survey_to_session(submission) self.survey.send_submission_notification(submission) flash(_('The survey has been submitted'), 'success') return redirect(url_for('.display_survey_list', self.event)) surveys = Survey.query.with_parent(self.event).filter( Survey.is_visible).all() if not _can_redirect_to_single_survey(surveys): back_button_endpoint = '.display_survey_list' elif self.event.type_ != EventType.conference: back_button_endpoint = 'events.display' else: back_button_endpoint = None return self.view_class.render_template( 'display/survey_questionnaire.html', self.event, form=form, survey=self.survey, back_button_endpoint=back_button_endpoint, partial_completion=self.survey.partial_completion)
def _process(self): form = self._make_form() if form.validate_on_submit(): submission = self._save_answers(form) if submission.is_anonymous: submission.user = None submission.submitted_dt = now_utc() submission.is_submitted = True submission.pending_answers = {} db.session.flush() save_submitted_survey_to_session(submission) self.survey.send_submission_notification(submission) flash(_('The survey has been submitted'), 'success') return redirect(url_for('.display_survey_list', self.event)) surveys = Survey.query.with_parent(self.event).filter(Survey.is_visible).all() if not _can_redirect_to_single_survey(surveys): back_button_endpoint = '.display_survey_list' elif self.event.type_ != EventType.conference: back_button_endpoint = 'events.display' else: back_button_endpoint = None return self.view_class.render_template('display/survey_questionnaire.html', self.event, form=form, survey=self.survey, back_button_endpoint=back_button_endpoint, partial_completion=self.survey.partial_completion)
def _process(self): form = make_survey_form(self.survey)() if form.validate_on_submit(): submission = self._save_answers(form) save_submitted_survey_to_session(submission) self.survey.send_submission_notification(submission) flash(_('Your answers has been saved'), 'success') return redirect(url_for('.display_survey_list', self.event)) surveys = Survey.find_all(Survey.is_visible, Survey.event_id == int(self.event.id)) if not _can_redirect_to_single_survey(surveys): back_button_endpoint = '.display_survey_list' elif self.event.getType() != 'conference': back_button_endpoint = 'event.conferenceDisplay' else: back_button_endpoint = None return self.view_class.render_template('display/survey_questionnaire.html', self.event, form=form, event=self.event, survey=self.survey, back_button_endpoint=back_button_endpoint)
def _process(self): form = make_survey_form(self.survey)() if form.validate_on_submit(): submission = self._save_answers(form) save_submitted_survey_to_session(submission) self.survey.send_submission_notification(submission) flash(_('Your answers has been saved'), 'success') return redirect(url_for('.display_survey_list', self.event_new)) surveys = Survey.query.with_parent(self.event_new).filter(Survey.is_visible).all() if not _can_redirect_to_single_survey(surveys): back_button_endpoint = '.display_survey_list' elif self.event_new.type_ != EventType.conference: back_button_endpoint = 'event.conferenceDisplay' else: back_button_endpoint = None return self.view_class.render_template('display/survey_questionnaire.html', self._conf, form=form, event=self.event_new, survey=self.survey, back_button_endpoint=back_button_endpoint)
def _process(self): form = make_survey_form(self.survey)() if form.validate_on_submit(): submission = self._save_answers(form) save_submitted_survey_to_session(submission) self.survey.send_submission_notification(submission) flash(_("Your answers has been saved"), "success") return redirect(url_for(".display_survey_list", self.event_new)) surveys = Survey.query.with_parent(self.event_new).filter(Survey.is_visible).all() if not _can_redirect_to_single_survey(surveys): back_button_endpoint = ".display_survey_list" elif self.event_new.type_ != EventType.conference: back_button_endpoint = "event.conferenceDisplay" else: back_button_endpoint = None return self.view_class.render_template( "display/survey_questionnaire.html", self._conf, form=form, event=self.event_new, survey=self.survey, back_button_endpoint=back_button_endpoint, )