From a6f6cdf346310407c460e162ac24d1e9d42954e1 Mon Sep 17 00:00:00 2001 From: Stef Date: Sun, 29 Jun 2025 17:41:58 +0200 Subject: [PATCH] Add manual food item entry and update food item management Introduces a new route and template for manually adding food items. Updates food item edit and delete operations to use the food item's ID instead of barcode and adds ownership checks. Adjusts form and model to make barcode optional, and updates navigation and dashboard templates to reflect these changes. --- app.py | 1 - application/templates/base.html | 4 +- application/user/routes.py | 81 +++++++++++++------ .../user/templates/add_food_item_manual.html | 49 +++++++++++ application/user/templates/dashboard.html | 4 +- .../{ => user}/templates/food_item.html | 0 forms.py | 6 +- models.py | 4 +- 8 files changed, 114 insertions(+), 35 deletions(-) create mode 100644 application/user/templates/add_food_item_manual.html rename application/{ => user}/templates/food_item.html (100%) diff --git a/app.py b/app.py index d4c42a9..42647d0 100644 --- a/app.py +++ b/app.py @@ -115,7 +115,6 @@ def add_food_item(): assert form.protein.data is not None assert form.carbs.data is not None assert form.fat.data is not None - assert form.barcode.data is not None db.session.add( FoodItem( name=form.name.data, diff --git a/application/templates/base.html b/application/templates/base.html index 60d714b..27b5b63 100644 --- a/application/templates/base.html +++ b/application/templates/base.html @@ -23,11 +23,9 @@ - {% if current_user.is_admin %} - {% endif %}