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


Download files

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

Source Distribution

wagtail-streamfield-migrate-0.0.1.tar.gz (5.5 kB view hashes)

Uploaded Source

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