Improve the editing experience for JSONFields.
Review Request #9405 - Created Nov. 27, 2017 and submitted
JSONField) had a pretty underwhelming editing
experience when used in forms. The text field would just contain a big
blob of serialized JSON content, which was pretty hard to read and
Now, the text field shows a pretty-printed representation of the JSON
data, with all keys sorted to make it easier to find the key you want.
When saved, the resulting data is once again condensed, but with the
keys remaining sorted in the database.
In order to do this, the old
encoderargument for these classes has
been deprecated, with new
them. This allows the classes to decide when the encoder is constructed
and to provide additional arguments to control the behavior. Any
consumers providing a custom encoder today will not see the new editing
behavior, falling back on the legacy behavior instead.
Manually tested loading a JSON structure and editing it in the Admin UI.
Saw that the data was nicely indented and sorted. Saved it and saw that
the data was condensed in the database, but still sorted.
Unit tests pass.
- Changed parameter order for
- Fixed up some documentation to no longer mention a warning that's not actually emitted (copy/paste from
- Removed an extra blank line.
Revision 2 (+229 -18)
Checks run (2 succeeded)