def models_create(): form = ModelForm(request.form) if not form.validate(): return render_template("models/list.html", form=form, models=Product.query.all(), manufExists=Manufacturer.query.count() > 0, listeroo=Product.listByBrokenPercent()) t = Product(form.name.data) t.manufacturer = form.manufacturer.data t.eol = False db.session().add(t) db.session().commit() return redirect(url_for("models_index"))
def models_index(): return render_template("models/list.html", models=Product.query.all(), form=ModelForm(), manufExists=Manufacturer.query.count() > 0, listeroo=Product.listByBrokenPercent() )