yksa-django-kit/yksa_kit/context_processors.py
2026-08-17 22:50:10 +08:00

17 lines
583 B
Python

from __future__ import annotations
from django.conf import settings
from django.utils import timezone
#: Quick-pick zones for the navbar switcher; override with YKSA_COMMON_TIMEZONES.
DEFAULT_COMMON_TIMEZONES = ["UTC", "Europe/Moscow", "Asia/Yakutsk", "Asia/Tokyo"]
def ui_preferences(request):
return {
"current_timezone_name": timezone.get_current_timezone_name(),
"common_timezones": getattr(
settings, "YKSA_COMMON_TIMEZONES", DEFAULT_COMMON_TIMEZONES
),
"cookie_consent": request.COOKIES.get("yksa_cookie_consent", ""),
}