mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-29 19:00:00 +00:00
Add FoodLog model and update relationships
Introduces the FoodLog model to track user food consumption, adds relationships between User, FoodItem, and FoodLog, and updates seed.py to include sample FoodLog data. Also fixes route redirection to use the correct blueprint namespace.
This commit is contained in:
@@ -76,11 +76,13 @@ def add_food_item():
|
||||
)
|
||||
db.session.commit()
|
||||
print("[DEBUG] New item added")
|
||||
return redirect(url_for("food_item", barcode=form.barcode.data))
|
||||
return redirect(
|
||||
url_for("user.food_item", barcode=form.barcode.data)
|
||||
)
|
||||
else:
|
||||
print("[DEBUG] Invalid form")
|
||||
if form.barcode.data:
|
||||
return redirect(url_for("food_item", barcode=form.barcode.data))
|
||||
return redirect(url_for("user.food_item", barcode=form.barcode.data))
|
||||
else:
|
||||
return redirect(url_for("scan"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user