Code

Opened 2 years ago

Closed 2 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


Attachments (0)

Change History (1)

comment:1 Changed 2 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.