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 Distribution
wagtail_json_widget-0.0.7.tar.gz
(254.4 kB
view hashes)
Built Distribution
Close
Hashes for wagtail_json_widget-0.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb27ce2695c6898f9643ebad8de6e5320541399bc6e8969a8f8fd6e599a65099 |
|
MD5 | fb3829df408440ff0891736e26f530df |
|
BLAKE2b-256 | 09505d0144af1641f1cc58871748f887f67c22490475a4e890cbcf2090aca522 |
Close
Hashes for wagtail_json_widget-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62623c28e92500b138e0260e30354fc4668dd7afce671286af458ec1dc37138d |
|
MD5 | bff6d7c328b88d7596948878b50c5c70 |
|
BLAKE2b-256 | 58d18a9aa5656d2e1eff644714ddc0739d1e9488c2663dbbcf78d5598e708ad9 |