def organisation_edit(id): organisation = Organisations.query.filter(Organisations.id == id).first() form = OrganisationsForm(obj=organisation) if form.validate_on_submit(): form.populate_obj(organisation) db.session.add(organisation) db.session.commit() flash(_("Organisation edit")) return redirect(url_for("organisations.organisation")) return render_template("organisation_edit.html", form=form)
def organisation_add(): form = OrganisationsForm() if form.validate_on_submit(): organisation = Organisations(form.name.data) organisation.description = form.description.data db.session.add(organisation) db.session.commit() flash(_("Organisation added")) return redirect(url_for("organisations.organisation")) return render_template("organisation_add.html", form=form)