#31157: JSONField are not properly displayed in admin when they are readonly.
-----------------------------------------+----------------------------
Reporter: Gagaro | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 3.0
Severity: Normal | Keywords: admin json
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+----------------------------
JSONField values are displayed as dict when readonly in the admin.
For example, `{"foo": "bar"}` would be displayed as `{'foo': 'bar'}`,
which is not valid JSON.
I believe the fix would be to add a special case in
`django.contrib.admin.utils.display_for_field` to call the `prepare_value`
of the `JSONField` (not calling `json.dumps` directly to take care of the
`InvalidJSONInput` case).
--
Ticket URL: <https://code.djangoproject.com/ticket/31157>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.580116f69d1e01726b7e676d36c670d6%40djangoproject.com.