I have datetime information stored in the database as UTC. I'm displaying this info using Django admin.
Is there a way to display datetime information to the end-user's current timezone in Django admin?
Usually I think the logic for this would be in the template/view layer, however, Django-admin hides this all away from you and it seems like I would have to override many of the hidden files (which I don't want to do).
One idea is to subclass DateTimeField in the models and make it so that it converts it to local timezone whenever you grab it from the database, though I'm not sure if this will work.
Anyone have any suggestions? Thanks.
Localized timezone support is available in the soon-to-be-released Django 1.4.
Django 1.4 will introduce timezone support but the admin will still not be using it yet. There are still questions around which timezone implementation to "bless" (pytz), where to store the timezone per user (without built-in schema migration auth.User basically can't get touched without forcing every Django user to sync their database), and there isn't a UI for timezone selection yet.
So the parts are there but it's still DIY at this stage, sorry.
See the thread I started on django-developers
http://groups.google.com/group/django-developers/browse_thread/thread/1386a2bf73babc6a
If you know what time zone you would like to use, there are techniques for causing data entry and display within the admin to use that time zone. See the blog post https://www.caktusgroup.com/blog/2014/01/09/managing-events-explicit-time-zones/
In my case, all the admin users are in the time zone of the server, so I was able to use this approach to get the admin to use that time zone. Note that this is done on a per-field basis, rather than globally, however, and I don't know a way to get a date_hierarchy to use dates relative to this time zone.