Opened 3 years ago

Closed 3 years ago

#33289 closed Bug (invalid)

JSONField Form Field doesn't accept valid JSON boolean or null

Reported by: David Anderson Owned by: nobody
Component: Forms Version: 3.1
Severity: Normal Keywords: jsonfield json null boolean
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'm running into an issue with POSTing data to a django form using JSONField on postgres when the contents being posted includes true, false, or null.

It looks like others have run into this here and here:

Workarounds proposed in the above links involve making the json invalid as a work around by s/true/True/ or converting json true to a string.

Stacktrace info:

https://dpaste.org/eKYQ

Change History (1)

comment:1 by David Anderson, 3 years ago

Resolution: invalid
Status: newclosed

I apologize, dug through the traceback and it looks like ast eval crept into our codebase to accommodate previous field values. I've replaced it with a json.loads. Thanks for your attention on this still.

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