I'd like to have my Admin site use a different default timezone than the 
rest of my django app.

I prefer the backend and API to operate in UTC, because this is a general 
good practice for geographically distributed teams. However admin users 
(based in a specific timezone) find this confusing, and would like to see 
their datetimes in a local timezone (say, Pacific Time).

The docs state that a local time can be set using 
activate(): 
https://docs.djangoproject.com/en/4.0/ref/utils/#django.utils.timezone.activate

Specifically: 
https://docs.djangoproject.com/en/4.0/topics/i18n/timezones/#default-current-time-zone
 
says "You should set the current time zone to the end user’s actual time 
zone with activate() 
<https://docs.djangoproject.com/en/4.0/ref/utils/#django.utils.timezone.activate>.
 
Otherwise, the default time zone is used.".

Where should this be done to set the timezone only in the admin?

Simon Wilson has a suggestion to set this globally using 
Middleware: https://til.simonwillison.net/django/show-timezone-in-django-admin

I'm wondering if there's a better way that won't affect the TZ of non-admin 
requests. It seems that this should be configurable somewhere on the 
AdminSite.

Has anyone made this work specifically for the Django Admin?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7d09876e-5cdf-4010-abb1-bdbf5a71f41fn%40googlegroups.com.

Reply via email to