﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29150	Pretty display of JSONField data in forms	Andrew Wilson		"I think `django.contrib.postgres.forms.jsonb.JSONField` should be modified to display data in a more user-friendly way.

I am currently working  around it with the following code, but I can't see any reason this shouldn't be the default behaviour. I'm happy to open a pull request if this is deemed useful.

{{{
import json

from django.contrib.postgres.forms.jsonb import InvalidJSONInput, JSONField


class PrettyJSONField(JSONField):

    def prepare_value(self, value):
        if isinstance(value, InvalidJSONInput):
            return value

        return json.dumps(
            value,
            indent=4,
            sort_keys=True,
            separators=(',', ': '),
            ensure_ascii=False,
        )
}}}"	Cleanup/optimization	closed	contrib.postgres	2.0	Normal	duplicate		Herbert Fortes	Unreviewed	0	0	0	0	1	1
