Django ORM: time zone support
-
05-07-2019 - |
Question
Can you recommend any implementation of Time Zones support for Django's ORM (DateTime filed)?
Ideally it has to be DB-agnostic and transparent, allowing to use all standard ORM things like __lt, __gt etc.
I guess it needs to store time in UTC plus local timezone.
Thanks!
Solution 3
UTCDateTime seems to satisfy most of the requirements.
OTHER TIPS
You might want to look at the django-timezones app. It was posted in response to ticket #8953 on the django bug tracker. The ticket also talks about a bulbs application that the Onion uses on their site to handle timestamps.
I'm not aware of a pre-canned implementation you can use, but this post discusses how to implement a Django date field which maps to multiple database columns.