Skip to main content

JSONEditor for Wagtail CMS

Project description

Wagtail JSON Widget

JSON editing for Wagtail Admin with josdejong / jsoneditor. Provides widgets for Page and StreamField.

Screenshot

Installation

Install from PyPI:

pip install wagtail-json-widget

Then add the following to your project's INSTALLED_APPS.

'wagtail_json_widget',

Usage

As a field:

from django.db import models
from django import forms
from wagtail.admin.panels import FieldPanel
from wagtail.admin.forms import WagtailAdminPageForm

from wagtail.core.models import Page

from .blocks import MyStreamBlock
from wagtail_json_widget.widgets import JSONEditorWidget


class MyPageForm(WagtailAdminPageForm):
    myjson = forms.JSONField(widget=JSONEditorWidget, required=False)


class MyPage(Page):

    myjson = models.JSONField(null=True, blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('myjson'),
    ]
    base_form_class = MyPageForm

As a StreamField block:

from wagtail import blocks
from wagtail_json_widget.blocks import JSONBlock

class MyBlock(blocks.StructBlock):
    my_json_block = JSONBlock(default='{}')
    ...

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

wagtail_json_widget-0.0.8-py3-none-any.whl (257.3 kB view hashes)

Uploaded Python 3

Supported by

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