def _process(self): existing_group = self.group if not self.new_group else None form = EditGroupForm(obj=existing_group, group=existing_group) if form.validate_on_submit(): form.populate_obj(self.group) if self.new_group: db.session.add(self.group) msg = _("The group '{name}' has been created.") else: msg = _("The group '{name}' has been updated.") db.session.flush() flash(msg.format(name=self.group.name), "success") return redirect(url_for(".groups")) return WPGroupsAdmin.render_template("group_edit.html", group=existing_group, form=form)
def _process(self): existing_group = self.group if not self.new_group else None form = EditGroupForm(obj=existing_group, group=existing_group) if form.validate_on_submit(): form.populate_obj(self.group) if self.new_group: db.session.add(self.group) msg = _("The group '{name}' has been created.") else: msg = _("The group '{name}' has been updated.") db.session.flush() flash(msg.format(name=self.group.name), 'success') return redirect(url_for('.groups')) return WPGroupsAdmin.render_template('group_edit.html', group=existing_group, form=form)