Closed rwlogel closed 9 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
b4f6c29
) 87.45% compared to head (94a5570
) 87.45%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Are you sure that it works correct for the django-admin <-> model time fields
?
I verified it in our project which has implemented the admin timezone switching feature as outlined in the Django documentation which I linked in the description.
A simple way to see it in action would be to use a middleware that locks the timezone:
class AdminTimezoneMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
if request.path.startswith('/admin/'):
with timezone.override(ZoneInfo('America/New_York')):
return self.get_response(request)
return self.get_response(request)
With this middleware all the datetimes shown use the wrapped timezone, except the ones generated by the filter which are always UTC because that is the default timezone, not the active one.
Checked. Thanks you
If the timezone is set using this approach from the Django docs then it should be using the current timezone not the default one.