mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-29 19:00:00 +00:00
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.
12 lines
302 B
Python
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()
|