Files
cal_counter/seed.py
Stef 700b351b0e Add edit and delete functionality for food items
Implemented routes and templates to allow users to edit and delete their food items from the dashboard. Updated dashboard template to include Edit and Delete buttons. Refactored template locations and removed unused dashboard.html. Fixed redirect logic in app.py and updated seed data.
2025-06-29 13:54:31 +02:00

25 lines
615 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",
owner_id=1,
energy=430,
fats=19,
carbs=59,
protein=5.5,
saturated_fats=10,
sugar=35,
barcode=2278012003502,
)
)
db.session.commit()