django-json-widget

Django json widget is an alternative widget that makes it easy to edit the jsonfield field of django.


Keywords
django-json-widget
License
MIT
Install
pip install django-json-widget==1.1.0

Documentation

django-json-widget

image

image

image

An alternative widget that makes it easy to edit the new Django's field JSONField (PostgreSQL specific model fields)

Quickstart

Install django-json-widget:

pip install django-json-widget

Add it to your `INSTALLED_APPS`:

Add the widget in your admin.py:

You can also add the widget in your forms.py:

Configuration

You can customize the JSONEditorWidget with the following options:

  • width: Width of the editor as a string with CSS size units (px, em, % etc). Defaults to 90%.
  • height: Height of the editor as a string CSS size units. Defaults to 550px.
  • options: A dict of options accepted by the JSON editor. Options that require functions (eg. onError) are not supported.
  • mode (deprecated): The default editor mode. This argument is redundant because it can be specified as a part of options. Preserved for backwards compatibility with version 0.2.0.
  • attrs: HTML attributes to be applied to the wrapper element. See the Django Widget documentation.

JSONEditorWidget widget

Before:

image

After:

image

Credits

Tools used in rendering this package: