Example #1
0
 def _make_form(self):
     survey_form_class = make_survey_form(self.survey)
     if self.submission and request.method == 'GET':
         return survey_form_class(
             formdata=MultiDict(self.submission.pending_answers))
     else:
         return survey_form_class()
Example #2
0
def _render_questionnaire_preview(survey):
    # load the survey once again with all the necessary data
    survey = (Survey.find(id=survey.id).options(
        joinedload(Survey.sections).joinedload(SurveySection.children)).one())
    tpl = get_template_module(
        'events/surveys/management/_questionnaire_preview.html')
    form = make_survey_form(survey)()
    return tpl.render_questionnaire_preview(survey, form, get_field_types())
Example #3
0
def _render_questionnaire_preview(survey):
    # load the survey once again with all the necessary data
    survey = (Survey
              .find(id=survey.id)
              .options(joinedload(Survey.sections).joinedload(SurveySection.children))
              .one())
    tpl = get_template_module('events/surveys/management/_questionnaire_preview.html')
    form = make_survey_form(survey)()
    return tpl.render_questionnaire_preview(survey, form, get_field_types())
Example #4
0
 def _process(self):
     field_types = get_field_types()
     preview_form = make_survey_form(self.survey)()
     return WPManageSurvey.render_template(
         'management/survey_questionnaire.html',
         self.event,
         survey=self.survey,
         field_types=field_types,
         preview_form=preview_form)
Example #5
0
    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)
Example #6
0
    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)
Example #7
0
    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,
        )
Example #8
0
 def _process(self):
     field_types = get_field_types()
     preview_form = make_survey_form(self.survey)()
     return WPManageSurvey.render_template('management/survey_questionnaire.html', self.event, survey=self.survey,
                                           field_types=field_types, preview_form=preview_form)
Example #9
0
 def _make_form(self):
     survey_form_class = make_survey_form(self.survey)
     if self.submission and request.method == 'GET':
         return survey_form_class(formdata=MultiDict(self.submission.pending_answers))
     else:
         return survey_form_class()