#6 Added Database functionality for user to click and load a single item

This commit is contained in:
2024-01-23 17:53:00 +00:00
parent 1f518ff56d
commit 95768f8a8c
4 changed files with 35 additions and 1 deletions

View File

@ -64,6 +64,16 @@ def category(category: str):
@blueprint.route('/<int:id>')
def id(id: int):
""" Loads a given product based on ID """
db = ProductController()
product = db.read_id(id)
# Check that a valid product was returned
if product is None:
flash("No Product available here")
return redirect("/")
print(product.name)
return render_template('index.html', content='content.html', products = [product])
return "ID: " + str(id)