Add products and quantities pages
This commit is contained in:
33
webui.py
Normal file
33
webui.py
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
InvMan Web UI
|
||||
|
||||
Web User Interface for InvMan
|
||||
"""
|
||||
|
||||
# Imports
|
||||
from flask import Flask, render_template
|
||||
|
||||
from libdb import Session, Product, ProductQuantity
|
||||
|
||||
|
||||
app = Flask(__name__) # app is the Flask app
|
||||
|
||||
|
||||
@app.route("/ui/products")
|
||||
def products_list_page():
|
||||
"""Route for the products page"""
|
||||
session = Session()
|
||||
data = session.query(
|
||||
Product.upc, Product.brand, Product.name,
|
||||
Product.size, Product.sizeunit, Product.description).all()
|
||||
return render_template("ui/products.html", data=data)
|
||||
|
||||
|
||||
@app.route("/ui/quantities")
|
||||
def products_quantities_page():
|
||||
"""Route for the quantities page"""
|
||||
session = Session()
|
||||
data = session.query(ProductQuantity.product_upc,
|
||||
ProductQuantity.quantity, ProductQuantity.location).all()
|
||||
return render_template("ui/quantities.html", data=data)
|
Reference in New Issue
Block a user