mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-29 19:00:00 +00:00
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.
23 lines
556 B
Python
23 lines
556 B
Python
from application import db, app
|
|
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()
|