Opened 12 years ago

Closed 12 years ago

#18370 closed Uncategorized (invalid)

DATETIME_FORMAT has not effect on json serializer

Reported by: info@… Owned by: nobody
Component: Uncategorized Version: 1.4
Severity: Normal Keywords: DATETIME_FORMAT
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I used before django 1.3 and was happy with his format for datetime field.

I just updated to 1.4 but I found that the json serializer uses a different time format to format the date.

I tried the use DATETIME_FORMAT in the settings to have the previous format but without no luck.

In fact looking in the code, the serialized doesn't use it at all.

Is there any way to change this format without messing with source code of the serializer?

Thanks in advance for the support!

Luca


Change History (1)

comment:1 by Aymeric Augustin, 12 years ago

Resolution: invalid
Status: newclosed

Hi Luca,

Since Django 1.4, the JSON serializer uses the datetime format defined in the JSON specification. This change is documented in the release notes: https://docs.djangoproject.com/en/1.4/releases/1.4/#serialization-of-datetime-and-time

You can probably create a different behavior by subclassing Django's JSON serializer. If you want to discuss this idea, please use the django-users mailing list or the #django IRC channel; the bug tracker focuses on bugs in Django.

Note: See TracTickets for help on using tickets.
Back to Top