JSONEditor for Wagtail CMS
Project description
Wagtail JSON Widget
JSON editing for Wagtail Admin with josdejong / jsoneditor. Provides widgets for Page and StreamField.
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
Close
Hashes for wagtail_json_widget-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c0cb3d6c882674662e2b00f798c7be122d760e4b91744f490c545f4994a102e |
|
MD5 | fdf6b6b5d9cb3036a8a68c9dc62e4ffe |
|
BLAKE2b-256 | e3cd0e09ead08696d8cf60e9192e9b515617c10e48d13ce6c9bcab58cdc7ffc2 |