Skip to main content

JSONEditor for Wagtail CMS

Project description

Wagtail JSON Widget

JSON editing for Wagtail Admin.

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.edit_handlers 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)

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

As a StreamField block:

from wagtail.core import blocks
from wagtail_json_widget.blocks import JsonBlock

class MyBlock(blocks.StructBlock):
    my_json_block = JsonBlock()
    ...
    

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

wagtail_json_widget-0.0.1.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

wagtail_json_widget-0.0.1-py3-none-any.whl (5.6 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