I'm new to django and is working on an application that can store user notes and reminder time. I have followed the Django document(https://docs.djangoproject.com/en/3.2/topics/i18n/timezones/) and added TimezoneMiddleware to middleware, set_timezone method, and timezone template. But still not able to get the correct user timezone, it always shows as UTC.
I'm not sure if there anything need to be add in frontend part? because as in code:
class TimezoneMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
tzname = request.session.get('django_timezone')
if tzname:
timezone.activate(pytz.timezone(tzname))
else:
timezone.deactivate()
return self.get_response(request)
it seems should get timezone information from session data, but I have checked and there no timezone information there.
Would anyone suggest what I might missed? Thank you.