mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-29 19:00:00 +00:00
Refactor food item model and add barcode scanner page
Renamed FoodItems to FoodItem and Units to Unit in models.py, updated related imports and usage throughout the codebase. Added a barcode scanner test page using ZXing in the admin section. Improved food_items.html to display nutritional information in a table. Registered the admin blueprint in app.py and cleaned up blueprint registration in __init__.py. Updated seed.py to use the new FoodItem model.
This commit is contained in:
17
seed.py
17
seed.py
@@ -1,11 +1,22 @@
|
||||
from application import db, app
|
||||
from models import User, FoodItems
|
||||
from models import User, FoodItem
|
||||
|
||||
with app.app_context():
|
||||
User.query.delete()
|
||||
db.session.add(User(username="admin", password="admin", is_admin=True))
|
||||
db.session.add(User(username="user", password="user", is_admin=False))
|
||||
|
||||
|
||||
|
||||
FoodItem.query.delete()
|
||||
db.session.add(
|
||||
FoodItem(
|
||||
name="AH Matcha cookie",
|
||||
energy=430,
|
||||
fats=19,
|
||||
carbs=59,
|
||||
protein=5.5,
|
||||
saturated_fats=10,
|
||||
sugar=35,
|
||||
)
|
||||
)
|
||||
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user