Add search box for location to quantities page
This commit is contained in:
17
webui.py
17
webui.py
@ -6,7 +6,7 @@ Web User Interface for InvMan
|
||||
"""
|
||||
|
||||
# Imports
|
||||
from flask import Flask, render_template
|
||||
from flask import Flask, render_template, request
|
||||
|
||||
from libdb import Session, Product, ProductQuantity
|
||||
|
||||
@ -28,6 +28,15 @@ def products_list_page():
|
||||
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)
|
||||
query = session.query(ProductQuantity.product_upc,
|
||||
ProductQuantity.quantity, ProductQuantity.location)
|
||||
if "location" in request.args:
|
||||
searchloc = request.args['location']
|
||||
if len(request.args['location']) > 0:
|
||||
data = query.filter(ProductQuantity.location == request.args['location']).all()
|
||||
else:
|
||||
data = query.all()
|
||||
else:
|
||||
searchloc = ""
|
||||
data = query.all()
|
||||
return render_template("ui/quantities.html", data=data, searchloc=searchloc)
|
||||
|
Reference in New Issue
Block a user