Files
cal_counter/seed.py
Stef a5312d7ad0 Add admin check and update FoodItems model
Introduced an admin_required check for all admin routes using Flask-Login's current_user. Updated the FoodItems model to use per-100g nutritional fields and removed unit relationships. Seed script now creates both admin and regular user accounts.
2025-06-27 17:23:54 +02:00

12 lines
302 B
Python

from application import db, app
from models import User, FoodItems
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))
db.session.commit()