Skip to main content

Django Flat JSON Key/Value Widget

Project description

CI build status Test Coverage Dependency monitoring Chat Pypi Version Downloads code style: black Django Flat JSON (key/value) Widget

If you ever needed to store a flexible dictionary of keys and values in your django models, you may have felt the need of giving your users a widget to easily manipulate the data by adding or removing rows, instead of having to edit the raw JSON.

This package solves exactly that problem: it offers a widget to manipulate a flat JSON object made of simple keys and values.

Compatibility

Tested on python >= 3.9 and Django 4.2, 5.1 and 5.2.

It should work also on previous versions of Django.

Install stable version from pypi

Install from pypi:

pip install django-flat-json-widget

Usage

Add flat_json_widget to INSTALLED_APPS:

INSTALLED_APPS = [
    # other apps...
    "flat_json_widget",
]

Then load the widget where you need it, for example, here’s how to use it in the django admin site:

from django.contrib import admin
from django import forms
from .models import JsonDocument

from flat_json_widget.widgets import FlatJsonWidget


class JsonDocumentForm(forms.ModelForm):
    class Meta:
        widgets = {"content": FlatJsonWidget}


@admin.register(JsonDocument)
class JsonDocumentAdmin(admin.ModelAdmin):
    list_display = ["name"]
    form = JsonDocumentForm

Installing for development

Install your forked repo:

git clone git://github.com/<your_fork>/django-flat-json-widget
cd django-flat-json-widget/
python setup.py develop

Install development dependencies:

pip install -e .[test]
npm install -g jslint jshint stylelint

Create database:

cd tests/
./manage.py migrate
./manage.py createsuperuser

Launch development server:

./manage.py runserver 0.0.0.0:8000

You can access the admin interface at http://127.0.0.1:8000/admin/.

Run tests with:

./runtests.py

Run quality assurance tests with:

./run-qa-checks

Contributing

Please refer to the OpenWISP contributing guidelines.

Changelog

See CHANGES.

License

See LICENSE.

Support

See OpenWISP Support Channels.

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_flat_json_widget-0.4.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_flat_json_widget-0.4-py2.py3-none-any.whl (17.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django_flat_json_widget-0.4.tar.gz.

File metadata

  • Download URL: django_flat_json_widget-0.4.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_flat_json_widget-0.4.tar.gz
Algorithm Hash digest
SHA256 76e418db918053fd714a67429162fa87c9e47d9f3fc8e4566741922e86793040
MD5 f26a6f837f542697799c0605355a1bb6
BLAKE2b-256 b0923467f6f71aa0e99d9ee7f5e60d8e738429a15e3c52bfd61b3c852225e99f

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_flat_json_widget-0.4.tar.gz:

Publisher: pypi.yml on openwisp/django-flat-json-widget

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_flat_json_widget-0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_flat_json_widget-0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 58e37c8e6f880f17188987da0eb191fba0c5f6ef2859e1596d130a447a581b7c
MD5 42bb5a769d73df5ba2b919b1e37cc2a6
BLAKE2b-256 6a067fef189fe0667e63d23d05d7865e40a9d7cb4cb48163ee1ade9a38988c0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_flat_json_widget-0.4-py2.py3-none-any.whl:

Publisher: pypi.yml on openwisp/django-flat-json-widget

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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