-
Install
django-jsonform
pip install django-jsonform
-
Add
django-jsonform
to installed appsINSTALLED_APPS = [ ... "django_jsonform", ... ]
-
Add additional field to constance in django settings
CONSTANCE_ADDITIONAL_FIELDS = {
"my_band_list": [
"django_jsonform.forms.fields.JSONFormField",
{
"schema": {
"type": "array",
"items": {
"type": "dict",
"keys": {
"genre": {
"type": "string",
},
"band": {
"type": "string",
},
},
},
}
},
],
}
-
Add constance field in django settings
CONSTANCE_CONFIG = { "MY_FAVORITE_BANDS": ( [{"genre": "Krautrock", "band": "Can"}], "List of my favorite bands", "my_band_list", ), }
-
Done! You should now have a json editable field in constance