mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-30 03:10:00 +00:00
Add meal v2 flow and user timezone support
Introduces a new add_meal_v2 blueprint with barcode scanning, item search, and improved meal logging UI. Adds user timezone support: login form now captures timezone, User model and database schema updated, and timezone is set on login. Refactors templates and forms to support these changes, and removes the old login template.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from flask_login import current_user
|
||||
from flask import redirect, url_for, flash
|
||||
from typing import Optional
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
|
||||
def login_required():
|
||||
@@ -19,3 +20,12 @@ def default_return(next_page: Optional[str] = None):
|
||||
if current_user.is_admin:
|
||||
return redirect(url_for("admin.food_items"))
|
||||
return redirect(url_for("dashboard"))
|
||||
|
||||
|
||||
def is_valid_timezone(tz: str) -> bool:
|
||||
try:
|
||||
ZoneInfo(tz)
|
||||
except Exception:
|
||||
print(Exception)
|
||||
return False
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user