Skip to main content

JSON Editor support for Django JSON Fields

Project description

Django JSON Editor Field

The Django JSON Editor field enhances Djangos JSON Field add adds a json-editor on top. You can use a JSON Schema to describe a form for the underlying JSON field. The input is then stored as JSON.

Usage

Add django_json_editor_field to your INSTALLED_APPS.

Use the field in your model:

from django_json_editor_field.fields import JSONEditorField

schema = {
        "title": "My JSON Array of Objects",
        "type": "array",
        "format": "table",
        "items": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string",
                },
                "start": {
                    "type": "string",
                    "format": "date",
                },
                "end": {
                    "type": "string",
                    "format": "date",
                }
            }
        }
}

data = JSONEditorField(schema=schema)

json-editor has some options. You can set them using the options argument to the JSONEditorField.

options = {
    "theme": "bootstrap4",
    "disable_collapse": True,
}
schema = {
    ...
}
data = JSONEditorField(schema=schema, options=options)

Internally, the schema gets added to the schema attribute of the options and only the options object gets passed on to the json-editor. This means you can also define the schema as part of the options directly.

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_editor_field-0.4.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

django_json_editor_field-0.4.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file django_json_editor_field-0.4.2.tar.gz.

File metadata

File hashes

Hashes for django_json_editor_field-0.4.2.tar.gz
Algorithm Hash digest
SHA256 5fc03d649fc652b81a461ba84486113373e4a79b9cec7897e42c4ba0d23cadc3
MD5 6efb119da240e2426a5a08fe01591dda
BLAKE2b-256 8dc8ed0f8d83eacb2dcdffb1b459da511eb3d52e26737291a236f5d5f892ff7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_json_editor_field-0.4.2.tar.gz:

Publisher: publish.yml on b1rger/django-json-editor-field

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_json_editor_field-0.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_json_editor_field-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d6b4c39b682338baaf0c7cec6fb661b049a82bef195d30745677045606d9226d
MD5 00896e22ac8a1026e12b042e416bb1e6
BLAKE2b-256 6eb4580de3389bb9e31abc89e4ef22f128316c216e3abb5014176c8aa9f099e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_json_editor_field-0.4.2-py3-none-any.whl:

Publisher: publish.yml on b1rger/django-json-editor-field

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