How to set local timezone only in django admin

1.4k Views Asked by At

I have UTC time zone in my django settings and I am showing UTC time format to user as well . But I want to change UTC time format to local time zone in django admin. I am using django 1.6. Is there a way to display datetime information to the end-user's current timezone in Django admin?

Thanks

1

There are 1 best solutions below

0
On

As far as I know, Django admin does not include any way to get the user's current timezone (you would need some javascript for that). But if you gather the timezone of your user in some other way (store in the database, for example), you can use the timezone.activate() function to make Django use that timezone when displaying dates.

The documentation gives an example here: https://docs.djangoproject.com/en/1.6/topics/i18n/timezones/#selecting-the-current-time-zone