def _process(self): form = ContributionTypeForm(event=self.event, obj=self.contrib_type) if form.validate_on_submit(): old_name = self.contrib_type.name form.populate_obj(self.contrib_type) db.session.flush() self.event.log(EventLogRealm.management, EventLogKind.change, 'Contributions', 'Updated type: {}'.format(old_name), session.user) return contribution_type_row(self.contrib_type) return jsonify_form(form)
def _process(self): form = ContributionTypeForm(event=self.event) if form.validate_on_submit(): contrib_type = ContributionType() form.populate_obj(contrib_type) self.event.contribution_types.append(contrib_type) db.session.flush() self.event.log(EventLogRealm.management, EventLogKind.positive, 'Contributions', 'Added type: {}'.format(contrib_type.name), session.user) return contribution_type_row(contrib_type) return jsonify_form(form)