def _process(self): form = SurveyForm(event=self.event, obj=self._get_form_defaults()) if form.validate_on_submit(): form.populate_obj(self.survey) db.session.flush() flash(_('Survey modified'), 'success') logger.info('Survey %s modified by %s', self.survey, session.user) return jsonify_data(flash=False) return jsonify_template('events/surveys/management/edit_survey.html', event=self.event, form=form, survey=self.survey)
def _process(self): form = SurveyForm(event=self.event, obj=self._get_form_defaults()) if form.validate_on_submit(): form.populate_obj(self.survey) db.session.flush() flash(_('Survey modified'), 'success') logger.info('Survey {} modified by {}'.format(self.survey, session.user)) return redirect(url_for('.manage_survey', self.survey)) return WPManageSurvey.render_template('management/edit_survey.html', self.event, event=self.event, form=form, survey=self.survey)
def _process(self): form = SurveyForm(event=self.event, obj=self._get_form_defaults()) if form.validate_on_submit(): form.populate_obj(self.survey) db.session.flush() flash(_('Survey modified'), 'success') logger.info('Survey %s modified by %s', self.survey, session.user) return redirect(url_for('.manage_survey', self.survey)) return WPManageSurvey.render_template('management/edit_survey.html', self.event, event=self.event, form=form, survey=self.survey)
def _process(self): form = SurveyForm(obj=FormDefaults(require_user=True), event=self.event) if form.validate_on_submit(): survey = Survey(event=self.event) # add a default section so people can start adding questions right away survey.items.append(SurveySection(display_as_section=False)) form.populate_obj(survey) db.session.add(survey) db.session.flush() flash(_('Survey created'), 'success') logger.info('Survey %s created by %s', survey, session.user) return jsonify_data(flash=False) return jsonify_template('events/surveys/management/edit_survey.html', event=self.event, form=form, survey=None)
def _process(self): form = SurveyForm(obj=FormDefaults(require_user=True), event=self.event) if form.validate_on_submit(): survey = Survey(event_new=self.event.as_event) # add a default section so people can start adding questions right away survey.items.append(SurveySection(display_as_section=False)) form.populate_obj(survey) db.session.add(survey) db.session.flush() flash(_('Survey created'), 'success') logger.info('Survey {} created by {}'.format(survey, session.user)) return redirect(url_for('.manage_survey', survey)) return WPManageSurvey.render_template('management/edit_survey.html', self.event, event=self.event, form=form, survey=None)