=============================
django-json-widget
=============================
.. image:: https://badge.fury.io/py/django-json-widget.svg
:target: https://badge.fury.io/py/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
Development Guide
-----------------
Read the contribution guide.
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.4 (2025-10-11)
------------------
* Fix dark mode CSS support #107
2.0.3 (2025-07-29)
------------------
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/d9/3c/62371085d3650ffb5a885f2e652f83dda79a38833a3979d0eef269289a59/django_json_widget-2.0.4.tar.gz",
"platform": null,
"description": "=============================\r\ndjango-json-widget\r\n=============================\r\n\r\n.. image:: https://badge.fury.io/py/django-json-widget.svg\r\n :target: https://badge.fury.io/py/django-json-widget\r\n\r\n\r\nAn alternative widget that makes it easy to edit the new Django's field JSONField (PostgreSQL specific model fields)\r\n\r\n\r\nQuickstart\r\n----------\r\n\r\nInstall django-json-widget::\r\n\r\n pip install django-json-widget\r\n\r\nAdd it to your `INSTALLED_APPS`:\r\n\r\n.. code-block:: python\r\n\r\n INSTALLED_APPS = (\r\n ...\r\n 'django_json_widget',\r\n ...\r\n )\r\n\r\nAdd the widget in your admin.py:\r\n\r\n.. code-block:: python\r\n\r\n from django.contrib import admin\r\n from django.db.models import JSONField\r\n from django_json_widget.widgets import JSONEditorWidget\r\n from .models import YourModel\r\n\r\n\r\n @admin.register(YourModel)\r\n class YourModelAdmin(admin.ModelAdmin):\r\n formfield_overrides = {\r\n JSONField: {'widget': JSONEditorWidget},\r\n }\r\n\r\nYou can also add the widget in your forms.py:\r\n\r\n.. code-block:: python\r\n\r\n from django import forms\r\n from django_json_widget.widgets import JSONEditorWidget\r\n from .models import YourModel\r\n\r\n\r\n class YourForm(forms.ModelForm):\r\n class Meta:\r\n model = YourModel\r\n\r\n fields = ('jsonfield',)\r\n\r\n widgets = {\r\n 'jsonfield': JSONEditorWidget\r\n }\r\n\r\nConfiguration\r\n-------------\r\n\r\nYou can customize the JSONEditorWidget with the following options:\r\n\r\n* **width**: Width of the editor as a string with CSS size units (px, em, % etc). Defaults to ``90%``.\r\n* **height**: Height of the editor as a string CSS size units. Defaults to ``550px``.\r\n* **options**: A dict of options accepted by the `JSON editor`_. Options that require functions (eg. onError) are not supported.\r\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.\r\n* **attrs**: HTML attributes to be applied to the wrapper element. See the `Django Widget documentation`_.\r\n\r\n.. _json editor: https://github.com/josdejong/jsoneditor/blob/master/docs/api.md#configuration-options\r\n.. _Django Widget documentation: https://docs.djangoproject.com/en/2.1/ref/forms/widgets/#django.forms.Widget.attrs\r\n\r\n\r\nJSONEditorWidget widget\r\n-----------------------\r\n\r\nBefore:\r\n\r\n.. image:: https://raw.githubusercontent.com/jmrivas86/django-json-widget/master/imgs/jsonfield_0.png\r\n\r\nAfter:\r\n\r\n.. image:: https://raw.githubusercontent.com/jmrivas86/django-json-widget/master/imgs/jsonfield_1.png\r\n\r\n\r\nDevelopment Guide\r\n-----------------\r\n\r\nRead the contribution guide.\r\n\r\n\r\nCredits\r\n-------\r\n\r\nTools used in rendering this package:\r\n\r\n* Cookiecutter_\r\n* `cookiecutter-djangopackage`_\r\n\r\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\r\n.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage\r\n\r\n\r\n=========\r\nChangelog\r\n=========\r\n\r\n2.0.4 (2025-10-11)\r\n------------------\r\n\r\n* Fix dark mode CSS support #107\r\n\r\n2.0.3 (2025-07-29)\r\n------------------\r\n\r\n2.0.2 (2025-07-28)\r\n------------------\r\n\r\n* Fix Version 2.0.1 causes rendering HTML scripts issue #80\r\n\r\n2.0.1 (2024-03-02)\r\n------------------=\r\n\r\n* Fixed Version 2.0.0 causes issues with Django 4.x due to missing sourcemaps issue #83\r\n\r\n2.0.0 (2024-03-24)\r\n------------------\r\n\r\n* Fix default paths for static files #53\r\n* Stop declaring support for Django versions before 3.2 #65\r\n* Avoid HTML injection via unsafe JSON injection #64\r\n* Remove source map reference from JS bundle #70\r\n* Add dark mode CSS support #82\r\n* Updated documentation\r\n\r\n1.1.1 (2021-02-17)\r\n------------------\r\n\r\n* Fix for issue #51, updates the bundled libs to 9.1.9 and additional notes for Django 3.1 changes\r\n\r\n1.1.0 (2021-02-05)\r\n------------------\r\n\r\n* Added functionality to override version of JSONEditor to use\r\n* update readme for django 3.1\r\n\r\n1.0.1 (2020-04-17)\r\n------------------\r\n\r\n* Stop resolving paths to the static files\r\n\r\n1.0.0 (2020-01-16)\r\n------------------\r\n\r\n* Update Makefile\r\n* Make Stable the project\r\n\r\n\r\n0.3.0 (2020-01-16)\r\n------------------\r\n\r\n* Update requirements.txt\r\n* Fixed static to work with CDN tools like django-storages\r\n* Make widget more configurable\r\n* Fixed an incompatibility with Python 2.7\r\n* update jsoneditor to latest version\r\n\r\n\r\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.4",
"project_urls": {
"Homepage": "https://github.com/jmrivas86/django-json-widget"
},
"split_keywords": [
"django-json-widget"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4be3e3efb596f1bd86e5413983646549cf07cb09262aee57e8adf8fb139baaee",
"md5": "32d0fa8b955e75281e534def3a67583e",
"sha256": "6509d78e326fa2db826530c2b8e59daf7736d9502dd42e4a15b60cc6ddc24a91"
},
"downloads": -1,
"filename": "django_json_widget-2.0.4-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "32d0fa8b955e75281e534def3a67583e",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 292946,
"upload_time": "2025-10-11T20:40:27",
"upload_time_iso_8601": "2025-10-11T20:40:27.227091Z",
"url": "https://files.pythonhosted.org/packages/4b/e3/e3efb596f1bd86e5413983646549cf07cb09262aee57e8adf8fb139baaee/django_json_widget-2.0.4-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d93c62371085d3650ffb5a885f2e652f83dda79a38833a3979d0eef269289a59",
"md5": "5bfcad3775cd7df0078fa46aeb903585",
"sha256": "ae118a96b34d2839cfa7fce9ba89cf31ee4dc5720ba00b879bd5f7edac5790fa"
},
"downloads": -1,
"filename": "django_json_widget-2.0.4.tar.gz",
"has_sig": false,
"md5_digest": "5bfcad3775cd7df0078fa46aeb903585",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 381393,
"upload_time": "2025-10-11T20:40:30",
"upload_time_iso_8601": "2025-10-11T20:40:30.337356Z",
"url": "https://files.pythonhosted.org/packages/d9/3c/62371085d3650ffb5a885f2e652f83dda79a38833a3979d0eef269289a59/django_json_widget-2.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-11 20:40:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jmrivas86",
"github_project": "django-json-widget",
"travis_ci": true,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "Django",
"specs": [
[
">=",
"5"
]
]
}
],
"tox": true,
"lcname": "django-json-widget"
}