예제 #1
0
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"))
예제 #2
0
def models_index():
    return render_template("models/list.html", models=Product.query.all(), form=ModelForm(),
                           manufExists=Manufacturer.query.count() > 0, listeroo=Product.listByBrokenPercent() )