Skip to main content

grafl.io integration for Wagtail CMS

Project description

Wagtail-Grafl

Create charts in Wagtail streamfields using the Grafl.io plotting service.

Installation

Install from PyPI:

pip install wagtail-grafl

Then add the following to your project's INSTALLED_APPS.

'wagtail_grafl',

Out of the box

There are currently three blocks available in wagtail-grafl.

GraflBlock

The primary block used for creating basic Grafl plots.

It consists of a single JSON field for entering Grafl plot data. It inherits from BaseGraflBlock.

JsonBlock

Simple formatted JSON field with basic validation and included in GraflBlock.

BaseGraflBlock

The BaseGraflBlock is provided to make it easy to extend wagtail-grafl and build your own bespoke Grafl blocks.

It provides the get_grafl_data method that needs to be overridden in any blocks that inherit from this.

The get_grafl_data method should return a dictionary of Grafl compatible data.

This make it possible for custom blocks to pull in data from other sources and generate Grafl plots programatically.

Settings

  • WAGTAIL_GRAFL_PLOT_DEFAULTS - a optional dictionary of default parameters that is merged with the blocks grafl data. This is useful for specifying parameters that should be consistent across all Grafl plot blocks.

Example use

Add the StreamBlock to a StreamField on a Wagtail page:

from wagtail import blocks
from wagtail_grafl.blocks import GraflBlock

class MyStreamBlock(blocks.StreamBlock):
    grafl_plot = GraflBlock()

Add the StreamBlock to a StreamField on a Wagtail page:

from wagtail.admin.edit_handlers import StreamFieldPanel
from wagtail.fields import StreamField
from wagtail.models import Page

from .blocks import MyStreamBlock


class MyPage(Page):

    body = StreamField(MyStreamBlock(), null=True)

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]

Then in the page template:

{% load static wagtailcore_tags %}

{% include_block page.body %}

About Grafl

Grafl is a plotting service that can be used to generate plots from basic JSON data. It's based on Plotly, free to use and very flexible.

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_grafl-0.0.2.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

wagtail_grafl-0.0.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_grafl-0.0.2.tar.gz.

File metadata

  • Download URL: wagtail_grafl-0.0.2.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.19

File hashes

Hashes for wagtail_grafl-0.0.2.tar.gz
Algorithm Hash digest
SHA256 751f8a5089df1a25a4b6c804522f49a543f525e9be788ca8db3ed58fba2d1caa
MD5 48ea4ded12ed3cd6325835996c817357
BLAKE2b-256 be8d40c29f0e25d25fb69f6c981674110277e117b21b5401c22ed70a1b8277b4

See more details on using hashes here.

File details

Details for the file wagtail_grafl-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: wagtail_grafl-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.19

File hashes

Hashes for wagtail_grafl-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 17f2677cccd0c09fa8d67c7c336076a30b6ca4c439c7945072d9a3c40965611c
MD5 bd1a4c85be7d21bb49cda23bf9b892e8
BLAKE2b-256 409688840c06ecaf32771936226781d36918d9e16a808c696c331e4fac1e17d1

See more details on using hashes here.

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