Skip to main content

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

Project description

https://badge.fury.io/py/django-json-widget.svg https://travis-ci.org/jmrivas86/django-json-widget.svg?branch=master https://codecov.io/gh/jmrivas86/django-json-widget/branch/master/graph/badge.svg

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 and choose the default mode:

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 = {
            # choose one mode from ['text', 'code', 'tree', 'form', 'view']
            'jsonfield': JSONEditorWidget(mode='code')
        }

JSONEditorWidget widget

Before:

https://raw.githubusercontent.com/jmrivas86/django-json-widget/master/imgs/jsonfield_0.png

After:

https://raw.githubusercontent.com/jmrivas86/django-json-widget/master/imgs/jsonfield_1.png

Credits

Tools used in rendering this package:

History

0.1.0 (2017-05-10)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-json-widget-0.2.0.tar.gz (191.4 kB view details)

Uploaded Source

Built Distribution

django_json_widget-0.2.0-py2.py3-none-any.whl (190.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-json-widget-0.2.0.tar.gz.

File metadata

  • Download URL: django-json-widget-0.2.0.tar.gz
  • Upload date:
  • Size: 191.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for django-json-widget-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0d995fbfd3169709fd43c190eb2fb2e7dbd84c41da7ba8c0db33fc399881264e
MD5 c5a55f78a693441c7f3d481974ca9954
BLAKE2b-256 1e325790452598c0e4e27998a8a0fb2ed9f0ee3d2d90acd68b1a4dcd6ef49af6

See more details on using hashes here.

File details

Details for the file django_json_widget-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_json_widget-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 190.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for django_json_widget-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 eeefe79863119e1507b1c208dfe27f0ce2fbf7b378c5022b8637b0a362c23202
MD5 5dd8ba0aa3b993cef447425b6a7ee166
BLAKE2b-256 795ac259286ff52cfabad5f3b0e42e5d4f18ffe99ec3994ff91e7cb41891c2c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page