Handling multiple timezones in Django Admin

163 views
Skip to first unread message

Paul Tiplady

unread,
Oct 2, 2018, 5:18:58 PM10/2/18
to Django users
Timezone handling in the Django admin is quite confusing when there are users in multiple timezones -- does anyone have a good way of handling this?

I'm using USE_TZ=True, TIME_ZONE='UTC', USE_I18N, USE_L10N. I have admin users in US/Pacific and US/Eastern.

When viewing a datetime field, users see the UTC time, with a note below saying "Note: You are 7 hours behind server time". This is better than nothing, but still quite sub-par for a 201x-era web UI. We really should be localizing the timezones in the browser to the user's own time zone, and submitting back to the app using TZ-aware timestamp strings. (It's possible to pull the TZ unambiguously from a modern browser: https://stackoverflow.com/a/37512371/37481).

Any suggestions for getting round this? I'm wondering if there's a good tz-aware datetime widget for the admin? Or perhaps a clean way of storing a User.time_zone config property that could be used to localize the admin cleanly.

Cheers,
Paul

Ramiro Morales

unread,
Oct 2, 2018, 5:49:10 PM10/2/18
to django...@googlegroups.com
Paul,

You seem to have a good grasp of the usability problem you describe and a sound strategy to solve it. You've even researched how modern web browser can help in improving this admin app feature.

I'm sure the project would accept a pull request implementing the changes you outline. Or if not, it would be a catalyst to get a solution for it into the code base sooner than later.

Feel free to try your hand.

Regards,

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/36a1bd2c-490d-4ad8-86f6-0af5425bb7f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages