#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 , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:3 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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.