def _process(self): form = TextForm() if form.validate_on_submit(): add_survey_text(self.section, form.data) flash(_('Text item added'), 'success') return jsonify_data(questionnaire=_render_questionnaire_preview(self.survey)) return jsonify_template('forms/form_common_fields_first.html', form=form)
def _process(self): form = TextForm(obj=FormDefaults(self.text)) if form.validate_on_submit(): form.populate_obj(self.text) db.session.flush() flash(_('Text item updated'), 'success') logger.info('Survey text item %s modified by %s', self.text, session.user) return jsonify_data(questionnaire=_render_questionnaire_preview(self.survey)) return jsonify_template('forms/form_common_fields_first.html', form=form)
def _process(self): form = TextForm(obj=FormDefaults(self.text)) if form.validate_on_submit(): form.populate_obj(self.text) db.session.flush() flash(_('Text item updated'), 'success') logger.info('Survey text item {} modified by {}'.format(self.text, session.user)) return jsonify_data(questionnaire=_render_questionnaire_preview(self.survey)) return jsonify_template('events/surveys/management/edit_survey_item.html', form=form)
def _process(self): form = TextForm() if form.validate_on_submit(): text = SurveyText() form.populate_obj(text) self.section.children.append(text) db.session.flush() flash(_('Text item added'), 'success') logger.info('Survey text item {} added by {}'.format(text, session.user)) return jsonify_data(questionnaire=_render_questionnaire_preview(self.survey)) return jsonify_template('events/surveys/management/edit_survey_item.html', form=form)
def _process(self): form = TextForm(obj=FormDefaults(self.text)) if form.validate_on_submit(): form.populate_obj(self.text) db.session.flush() flash(_('Text item updated'), 'success') logger.info('Survey text item {} modified by {}'.format( self.text, session.user)) return jsonify_data( questionnaire=_render_questionnaire_preview(self.survey)) return jsonify_template( 'events/surveys/management/edit_survey_item.html', form=form)
def _process(self): form = TextForm() if form.validate_on_submit(): text = SurveyText() form.populate_obj(text) self.section.children.append(text) db.session.flush() flash(_('Text item added'), 'success') logger.info('Survey text item {} added by {}'.format( text, session.user)) return jsonify_data( questionnaire=_render_questionnaire_preview(self.survey)) return jsonify_template( 'events/surveys/management/edit_survey_item.html', form=form)
def _import_section_item(self, section, data): self._remove_false_values(data) if data['type'] == 'text': form = TextForm(formdata=MultiDict(data.items()), csrf_enabled=False) if form.validate(): add_survey_text(section, form.data) else: raise ValueError('Invalid text item') elif data['type'] == 'question': for key, value in data['field_data'].iteritems(): if value is not None: data[key] = value field_cls = get_field_types()[data['field_type']] data = field_cls.process_imported_data(data) form = field_cls.create_config_form(formdata=MultiDict(data.items()), csrf_enabled=False) if not form.validate(): raise ValueError('Invalid question') add_survey_question(section, field_cls, form.data)