def _process(self): form = SplitCategoryForm(formdata=request.form) if form.validate_on_submit(): self._move_events(self.sel_events, form.first_category.data) if not form.all_selected.data: self._move_events(self.cat_events - self.sel_events, form.second_category.data) if form.all_selected.data: flash(_('Your events have been moved to the category "{}"') .format(form.first_category.data), 'success') else: flash(_('Your events have been split into the categories "{}" and "{}"') .format(form.first_category.data, form.second_category.data), 'success') return jsonify_data(flash=False, redirect=url_for('.manage_content', self.category)) return jsonify_form(form, submit=_('Split'))
def _process(self): form = SplitCategoryForm(formdata=request.form) if form.validate_on_submit(): self._move_events(self.sel_events, form.first_category.data) if not form.all_selected.data: self._move_events(self.cat_events - self.sel_events, form.second_category.data) if form.all_selected.data: flash(_('Your events have been moved to the category "{}"') .format(form.first_category.data), 'success') else: flash(_('Your events have been split into the categories "{}" and "{}"') .format(form.first_category.data, form.second_category.data), 'success') return jsonify_data(flash=False, redirect=url_for('.manage_content', self.category)) return jsonify_form(form, submit=_('Split'))