=============================
django-json-widget
=============================
.. image:: https://badge.fury.io/py/django-json-widget.svg
:target: https://badge.fury.io/py/django-json-widget
.. image:: https://travis-ci.org/jmrivas86/django-json-widget.svg?branch=master
:target: https://travis-ci.org/jmrivas86/django-json-widget
.. image:: https://codecov.io/gh/jmrivas86/django-json-widget/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jmrivas86/django-json-widget
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`:
.. code-block:: python
INSTALLED_APPS = (
...
'django_json_widget',
...
)
Add the widget in your admin.py:
.. code-block:: python
from django.contrib import admin
from django.db.models import JSONField
from django_json_widget.widgets import JSONEditorWidget
from .models import YourModel
@admin.register(YourModel)
class YourModelAdmin(admin.ModelAdmin):
formfield_overrides = {
JSONField: {'widget': JSONEditorWidget},
}
You can also add the widget in your forms.py:
.. code-block:: python
from django import forms
from django_json_widget.widgets import JSONEditorWidget
from .models import YourModel
class YourForm(forms.ModelForm):
class Meta:
model = YourModel
fields = ('jsonfield',)
widgets = {
'jsonfield': JSONEditorWidget
}
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`_.
.. _json editor: https://github.com/josdejong/jsoneditor/blob/master/docs/api.md#configuration-options
.. _Django Widget documentation: https://docs.djangoproject.com/en/2.1/ref/forms/widgets/#django.forms.Widget.attrs
JSONEditorWidget widget
-----------------------
Before:
.. image:: https://raw.githubusercontent.com/jmrivas86/django-json-widget/master/imgs/jsonfield_0.png
After:
.. image:: https://raw.githubusercontent.com/jmrivas86/django-json-widget/master/imgs/jsonfield_1.png
Credits
-------
Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-djangopackage`_
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage
=========
Changelog
=========
2.0.2 (2025-07-28)
------------------
* Fix Version 2.0.1 causes rendering HTML scripts issue #80
2.0.1 (2024-03-02)
------------------=
* Fixed Version 2.0.0 causes issues with Django 4.x due to missing sourcemaps issue #83
2.0.0 (2024-03-24)
------------------
* Fix default paths for static files #53
* Stop declaring support for Django versions before 3.2 #65
* Avoid HTML injection via unsafe JSON injection #64
* Remove source map reference from JS bundle #70
* Add dark mode CSS support #82
* Updated documentation
1.1.1 (2021-02-17)
------------------
* Fix for issue #51, updates the bundled libs to 9.1.9 and additional notes for Django 3.1 changes
1.1.0 (2021-02-05)
------------------
* Added functionality to override version of JSONEditor to use
* update readme for django 3.1
1.0.1 (2020-04-17)
------------------
* Stop resolving paths to the static files
1.0.0 (2020-01-16)
------------------
* Update Makefile
* Make Stable the project
0.3.0 (2020-01-16)
------------------
* Update requirements.txt
* Fixed static to work with CDN tools like django-storages
* Make widget more configurable
* Fixed an incompatibility with Python 2.7
* update jsoneditor to latest version
Raw data
{
"_id": null,
"home_page": "https://github.com/jmrivas86/django-json-widget",
"name": "django-json-widget",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "django-json-widget",
"author": "Jos\u00e9 Manuel Rivas",
"author_email": "jmrivas86@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6b/30/54e61b6a1c8bd47c9fc5eb758c25d9fc70c1aa0bc7e3c3c962f7e13dd034/django_json_widget-2.0.2.tar.gz",
"platform": null,
"description": "=============================\ndjango-json-widget\n=============================\n\n.. image:: https://badge.fury.io/py/django-json-widget.svg\n :target: https://badge.fury.io/py/django-json-widget\n\n.. image:: https://travis-ci.org/jmrivas86/django-json-widget.svg?branch=master\n :target: https://travis-ci.org/jmrivas86/django-json-widget\n\n.. image:: https://codecov.io/gh/jmrivas86/django-json-widget/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/jmrivas86/django-json-widget\n\nAn alternative widget that makes it easy to edit the new Django's field JSONField (PostgreSQL specific model fields)\n\n\nQuickstart\n----------\n\nInstall django-json-widget::\n\n pip install django-json-widget\n\nAdd it to your `INSTALLED_APPS`:\n\n.. code-block:: python\n\n INSTALLED_APPS = (\n ...\n 'django_json_widget',\n ...\n )\n\nAdd the widget in your admin.py:\n\n.. code-block:: python\n\n from django.contrib import admin\n from django.db.models import JSONField\n from django_json_widget.widgets import JSONEditorWidget\n from .models import YourModel\n\n\n @admin.register(YourModel)\n class YourModelAdmin(admin.ModelAdmin):\n formfield_overrides = {\n JSONField: {'widget': JSONEditorWidget},\n }\n\nYou can also add the widget in your forms.py:\n\n.. code-block:: python\n\n from django import forms\n from django_json_widget.widgets import JSONEditorWidget\n from .models import YourModel\n\n\n class YourForm(forms.ModelForm):\n class Meta:\n model = YourModel\n\n fields = ('jsonfield',)\n\n widgets = {\n 'jsonfield': JSONEditorWidget\n }\n\nConfiguration\n-------------\n\nYou can customize the JSONEditorWidget with the following options:\n\n* **width**: Width of the editor as a string with CSS size units (px, em, % etc). Defaults to ``90%``.\n* **height**: Height of the editor as a string CSS size units. Defaults to ``550px``.\n* **options**: A dict of options accepted by the `JSON editor`_. Options that require functions (eg. onError) are not supported.\n* **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.\n* **attrs**: HTML attributes to be applied to the wrapper element. See the `Django Widget documentation`_.\n\n.. _json editor: https://github.com/josdejong/jsoneditor/blob/master/docs/api.md#configuration-options\n.. _Django Widget documentation: https://docs.djangoproject.com/en/2.1/ref/forms/widgets/#django.forms.Widget.attrs\n\n\nJSONEditorWidget widget\n-----------------------\n\nBefore:\n\n.. image:: https://raw.githubusercontent.com/jmrivas86/django-json-widget/master/imgs/jsonfield_0.png\n\nAfter:\n\n.. image:: https://raw.githubusercontent.com/jmrivas86/django-json-widget/master/imgs/jsonfield_1.png\n\n\nCredits\n-------\n\nTools used in rendering this package:\n\n* Cookiecutter_\n* `cookiecutter-djangopackage`_\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage\n\n\n=========\nChangelog\n=========\n\n2.0.2 (2025-07-28)\n------------------\n\n* Fix Version 2.0.1 causes rendering HTML scripts issue #80\n\n2.0.1 (2024-03-02)\n------------------=\n\n* Fixed Version 2.0.0 causes issues with Django 4.x due to missing sourcemaps issue #83\n\n2.0.0 (2024-03-24)\n------------------\n\n* Fix default paths for static files #53\n* Stop declaring support for Django versions before 3.2 #65\n* Avoid HTML injection via unsafe JSON injection #64\n* Remove source map reference from JS bundle #70\n* Add dark mode CSS support #82\n* Updated documentation\n\n1.1.1 (2021-02-17)\n------------------\n\n* Fix for issue #51, updates the bundled libs to 9.1.9 and additional notes for Django 3.1 changes\n\n1.1.0 (2021-02-05)\n------------------\n\n* Added functionality to override version of JSONEditor to use\n* update readme for django 3.1\n\n1.0.1 (2020-04-17)\n------------------\n\n* Stop resolving paths to the static files\n\n1.0.0 (2020-01-16)\n------------------\n\n* Update Makefile\n* Make Stable the project\n\n\n0.3.0 (2020-01-16)\n------------------\n\n* Update requirements.txt\n* Fixed static to work with CDN tools like django-storages\n* Make widget more configurable\n* Fixed an incompatibility with Python 2.7\n* update jsoneditor to latest version\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Django json widget is an alternative widget that makes it easy to edit the jsonfield field of django.",
"version": "2.0.2",
"project_urls": {
"Homepage": "https://github.com/jmrivas86/django-json-widget"
},
"split_keywords": [
"django-json-widget"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8e1c82ea37095a8a1ed193250f5d8ef0f2feafafc4bf7c423dc14c5946a18286",
"md5": "d4d935c176ca75bfb31b22555d220fc1",
"sha256": "24cf9da85a9a6b39ff5a4867faee02d5ac01ec885f7be08f677154317e8a9aca"
},
"downloads": -1,
"filename": "django_json_widget-2.0.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d4d935c176ca75bfb31b22555d220fc1",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 293126,
"upload_time": "2025-07-28T10:43:46",
"upload_time_iso_8601": "2025-07-28T10:43:46.409958Z",
"url": "https://files.pythonhosted.org/packages/8e/1c/82ea37095a8a1ed193250f5d8ef0f2feafafc4bf7c423dc14c5946a18286/django_json_widget-2.0.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6b3054e61b6a1c8bd47c9fc5eb758c25d9fc70c1aa0bc7e3c3c962f7e13dd034",
"md5": "dbbea6e3fd7523ff56c5b16b977b313d",
"sha256": "ab7484407e123e5c78590804419f711b33b928ec5a782b388ba1a06cda7b0a70"
},
"downloads": -1,
"filename": "django_json_widget-2.0.2.tar.gz",
"has_sig": false,
"md5_digest": "dbbea6e3fd7523ff56c5b16b977b313d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 294326,
"upload_time": "2025-07-28T10:43:48",
"upload_time_iso_8601": "2025-07-28T10:43:48.953072Z",
"url": "https://files.pythonhosted.org/packages/6b/30/54e61b6a1c8bd47c9fc5eb758c25d9fc70c1aa0bc7e3c3c962f7e13dd034/django_json_widget-2.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-28 10:43:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jmrivas86",
"github_project": "django-json-widget",
"travis_ci": true,
"coveralls": true,
"github_actions": false,
"requirements": [
{
"name": "Django",
"specs": [
[
">=",
"5"
]
]
}
],
"tox": true,
"lcname": "django-json-widget"
}