Serializer DateTimeField has unexpected timezone information · Issue #3732 · encode/django-rest-framework (original) (raw)
I have TIME_ZONE = 'Asia/Kolkata'
and USE_TZ = True
in my settings.
When I create a new object with the browsable api, the serializer displays the newly created object with datetimes that have a trailing +5:30
, indicating the timezone. The database is storing the times in UTC.
The unexpected behavior is that when the object is serialized again later, the datetimes are all in UTC format with a trailing Z
. According to the Django docs on current and default time zone, I would expect the serializer to convert the datetimes to the current time zone, which defaults to the default time zone, which is set by TIME_ZONE = 'Asia/Kolkata'
.
Am I missing something?