django-jsoneditor-widget
Django form widget form JSONField
Demo
It look like this.
Install
- Install:
pip install django-jsoneditor-widget - Settings:
INSTALLED_APPS = [ # some apps .... 'jsoneditor', # other apps ... ]
Create model
from django.db import models
from django.contrib.postgres.fields import JSONField
class Book(models.Model):
name = models.CharField(max_length=150)
information = JSONField()
def __str__(self):
return self.name
Admin site settings
-
Use ModelAdmin
from django.contrib import admin from jsoneditor.admin import JSONFieldModelAdmin from .models import Book admin.site.register(Product, JSONFieldModelAdmin)
-
Use mixin
from django.contrib import admin from jsoneditor.admin import JSONFieldAdminMixin from .models import Book @admin.register(Book) class BookModelAdmin(JSONFieldAdminMixin, admin.ModelAdmin): pass
-
Use custom widget to specify jsoneditor options
from django.contrib import admin from django.contrib.postgres.fields import JSONField from jsoneditor.forms import JSONEditor from .models import Book class TextJSONEditor(JSONEditor): jsoneditor_options = { "mode": "text" } @admin.register(Book) class BookModelAdmin(admin.ModelAdmin): formfield_overrides = { JSONField: {"widget": TextJSONEditor} }
Metadata
Release files for untether-django-jsoneditor 0.1.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 | |
|---|---|---|---|---|
| untether-django-jsoneditor-0.1.0.tar.gz | 3.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| untether_django_jsoneditor-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 580.3 kB
Release files / untether-django-jsoneditor-0.1.0.tar.gz
| Download URL | untether-django-jsoneditor-0.1.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01860023f93b5dda9bf5cfb4c9a4637aac78bd07e2e56eb1f9f19cfec20e9134
|
|
BLAKE2b-256 checksum How to use checksums |
9fad1cb8cb2e20264dc379acd6210f7f7ae8076ae54c3429567cfde3d09917cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
|
Release files / untether_django_jsoneditor-0.1.0-py3-none-any.whl
| Download URL | untether_django_jsoneditor-0.1.0-py3-none-any.whl |
|---|---|
| Size | 577.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5ce061dff00df29057cd2aad13f99991cac0cd7f9106a13ed47d3c7f0697cd0
|
|
BLAKE2b-256 checksum How to use checksums |
fd1f05f507324aa4f1ac4e7d5de6113c9d3a44866cece90b8b5ee406f7952355
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
|
Security for untether-django-jsoneditor 0.1.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.