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:
INSTALLED_APPS = (
...
'django_json_widget',
...
)
Add the widget in your admin.py:
from django.contrib import admin
from django.contrib.postgres import fields
from django_json_widget.widgets import JSONEditorWidget
from .models import YourModel
@admin.register(YourModel)
class YourModelAdmin(admin.ModelAdmin):
formfield_overrides = {
fields.JSONField: {'widget': JSONEditorWidget},
}
You can also add the widget in your forms.py:
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.
JSONEditorWidget widget
Before:
After:
Credits
Tools used in rendering this package:
History
0.1.0 (2017-05-10)
First release on PyPI.
Metadata
Release files for django-json-widget 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-json-widget-0.3.0.tar.gz | 192.3 kB | Without provenance | Details for django-json-widget-0.3.0.tar.gz |
Release files / django-json-widget-0.3.0.tar.gz
| Download URL | django-json-widget-0.3.0.tar.gz |
|---|---|
| Size | 192.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5ec67dd71df2a2a0ffe3398874147af6ce7dbdc3043057911a664a821cf2d52
|
|
BLAKE2b-256 checksum How to use checksums |
ff6887f82d315456ed88228743408f9946da18987fcff49d6bf1dcea2a0a7131
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.5
|
Security for django-json-widget 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.