34 lines
871 B
Python
34 lines
871 B
Python
|
#!/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)
|