def editar(id): nucleo = Nucleo.query.get_or_404(id) form = NucleoForm(obj=nucleo) if request.method == "POST" and form.validate_on_submit(): form.populate_obj(nucleo) db.session.commit() flash(u"Núcleo editado com sucesso!", "success") return redirect("/nucleo/") return render_template("nucleo/form.html", form = form, menu="cadastros")
def novo(): form = NucleoForm() if request.method == "POST" and form.validate_on_submit(): nucleo = Nucleo() form.populate_obj(nucleo) db.session.add(nucleo) db.session.commit() flash(u"Núcleo adicionado com sucesso!", "success") return redirect("/nucleo/") return render_template("nucleo/form.html", form = form, menu="cadastros")