Tuesday, November 26, 2013

How to add timezone support in Django (1.5) admin

I am using django 1.5 with pytz. Currently all the datetimes stored in the database are in UTC. The frontend application is timezone aware (users worldwide), that means that I store the user timezone in his profile. Administration is using the default timezone as in settings.py (UTC).

What about if I want to give access to some user in another timezone (say -5), so for his sake it would be perfect to convert the times to his timezone, even the inputs, so when he edit a field, an automatic conversion to UTC will performed to update the value in DB.

What would be the approach to perform this change/hack/configuration in django administrator so it set a session timezone.

Thank you all

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c5556926-b866-4c13-ae2e-d0607bb40923%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment