Skip to main content

Wagtail utilities for streamfields

Project description

wagtail-streamfield-utils

API

iterators

flatten_streamfield(streamvalue)

Returns a generator, yielding (block, path) tuple to each block in a streamfield.

from streamfieldutils.iterators import flatten_streamfield

page = MyPage.objects.first()
# Print a slash-separated path to each block followed by the block's value.
for block, path in flatten_streamfield(page.body):
    print("/".join(path), block.value)

Contributing

Getting started

  1. Clone the repo git clone https://github.com/mikemonteith/wagtail-streamfield-utils.git
  2. Install dependencies pip install -e .[testing]

Formatting

black .

Linting

flake8 .

Tests

pytest

Project details


Release history Release notifications

Download files

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

Files for wagtail-streamfield-migrate, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size wagtail-streamfield-migrate-0.0.1.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page