Skip to main content

django-wagtail-blocks-exchange

Copy StreamField blocks between pages from the Wagtail editor — pick target pages and which StreamFields receive the block, without leaving the admin.

Portable Django package · MIT · by Aymane Nahji

Python 3.11+ Django 5+ Wagtail 6+ License: MIT


Why this package

Reuse a hero, testimonial, or promo block across the site without copy-paste in JSON or duplicate drafts by hand. Copy to pages appears on every block in every StreamField on the page editor — no single body field baked in.

  • Zero config — add the app; buttons show up when StreamFields render.
  • Smart targets — only pages you can edit that already support the block type on at least one StreamField.
  • Multi-select — many pages and many fields in one action; block is prepended at the top of each chosen field (new draft revision).
  • Staff-only API — CSRF-protected JSON and form endpoints under the admin prefix.

Quick start

pip install django-wagtail-blocks-exchange
INSTALLED_APPS = [
    # ...
    "wagtail",
    "wagtail_blocks_exchange",
]
python manage.py collectstatic --noinput   # production

Open any page with stream content, expand a block, and click Copy to pages.


Optional allowlist

Restrict which field names get server-side copy UI:

WAGTAIL_BLOCKS_EXCHANGE_STREAM_FIELDS = ["body", "footer"]

Legacy WAGTAIL_BLOCKS_EXCHANGE_BODY_FIELD is treated as a one-item allowlist. When unset, all StreamFields on the model are eligible.


Editor workflow

  1. Edit a page and open a block in any StreamField.
  2. Click Copy to pages.
  3. Choose target page(s), then the StreamField(s) on each page that should receive the block.
  4. Each target saves a draft revision — publish when you are ready.

Deep dive (security, i18n, copying rules): wagtail_blocks_exchange/README.md.


Admin API

Under the Wagtail admin prefix at blocks-exchange/:

Endpoint Method Purpose
eligible-pages/ POST JSON List editable pages that can accept the block type
copy-block/ POST form or JSON Copy block payload to selected pages and fields

eligible-pages/ accepts source_page_id, block_type, and optional source_stream_field_name. Responses include stream_fields per page.


Requirements

Dependency Version
Python 3.11+
Django 5.0+
Wagtail 6.0+

Source and target page models must share the same block type key in their stream definitions. The user needs edit permission on the source and every target.


Develop & test

pip install -e ".[dev]"
PYTHONPATH=. DJANGO_SETTINGS_MODULE=tests_project.settings python -m django test wagtail_blocks_exchange

Uses tests_project/ with BlocksExchangeTestPage.


Wagtail toolkit

Package Role
django-wagtail-ai-generation AI-assisted stream editing on the same page UI
django-wagtail-icon-chooser Lucide values copy as plain strings with the block

License

MIT — see LICENSE.

Metadata

Release files for django-wagtail-blocks-exchange 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-wagtail-blocks-exchange 0.1.1
File Size Uploaded Provenance Actions
django_wagtail_blocks_exchange-0.1.1.tar.gz 75.0 kB Without provenance Details for django_wagtail_blocks_exchange-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-wagtail-blocks-exchange 0.1.1
File Interpreter ABI Platform Actions
django_wagtail_blocks_exchange-0.1.1-py3-none-any.whl Python 3 none any Details for django_wagtail_blocks_exchange-0.1.1-py3-none-any.whl

Total release size: 105.7 kB

Release files / django_wagtail_blocks_exchange-0.1.1.tar.gz

Download URL django_wagtail_blocks_exchange-0.1.1.tar.gz
Size 75.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1a177561648cc4e2802f03af1ec6e92758e6085e307797d3eb3c5260c37c2cc2
BLAKE2b-256 checksum
How to use checksums
467c92db2c7e42e496119c6b01a4e6dbfb20d1402a116db60c9d54fea611472b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / django_wagtail_blocks_exchange-0.1.1-py3-none-any.whl

Download URL django_wagtail_blocks_exchange-0.1.1-py3-none-any.whl
Size 30.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e66b8b007db5323660a5357220c22571bcb8dbf327d59c31d44eefd7e9a48723
BLAKE2b-256 checksum
How to use checksums
c4ffeb09f1d9c3477665e7cfbb570dce7f91816720caa4e18a2869468371cbe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for django-wagtail-blocks-exchange 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page