Add products and quantities pages

This commit is contained in:
bbaovanc committed 2020-10-05 20:10:43 -05:00
1 parent b809edd49d
commit 82f37f4b25
3 files changed
+77

No files matched your search

+33
View 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)