You can set this up in Admin site with activate() as you found out. This
stack overflow answer shows that the developer uses stackedinline on the
admin site when representing to the user.
https://stackoverflow.com/a/38730431

Abdul Qoyyuum Bin Haji Abdul Kadir
System Engineer at Card Access Services
HP: +673 720 8043

On Thu, Jul 14, 2022, 2:16 AM Paul Tiplady <paultipl...@gmail.com> wrote:

> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7d09876e-5cdf-4010-abb1-bdbf5a71f41fn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/7d09876e-5cdf-4010-abb1-bdbf5a71f41fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA3DN%3DVtA_Y3T%2B548W5Wt_Oi9iv%2B%2BTb7BtjMmsU3%2BW9LAX-VUQ%40mail.gmail.com.

Reply via email to