Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23980 closed Cleanup/optimization (invalid)

DATETIME_FORMAT setting not applied with DjangoJSONEncoder

Reported by: DemarsM Owned by: nobody
Component: Core (Serialization) Version: 1.7
Severity: Normal Keywords:
Cc: DemarsM Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In my settings I have

DATETIME_FORMAT = 'Y-m-d H:i:s'
USE_L10N = False

I am doing:

data = [{'id':x.id, 'name':x.name, 'date_created': x.date_created} for x in instances_list]
jsonData = json.dumps(data, cls=DjangoJSONEncoder)

print jsonData
>>> [{"date_created": "2014-12-09T18:31:46.276Z", "id": 8, "name": "mun_flat"}]

date_created is a datetime field

Change History (4)

comment:1 by DemarsM, 10 years ago

Cc: DemarsM added

comment:2 by DemarsM, 10 years ago

Type: UncategorizedCleanup/optimization

comment:3 by Tim Graham, 10 years ago

Resolution: invalid
Status: newclosed

I believe this is intentional as we want to use a standard format so that data can be deserialized consistently regardless of the format used at the time of encoding.

comment:4 by Aymeric Augustin, 10 years ago

I agree with Tim.

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