Skip to main content

wagtail-block-fields

Use Wagtail's StructBlock, ListBlock, and MultipleChoiceBlock as standalone model fields.

Just like StreamField wraps StreamBlock, this package provides:

  • StructField - wraps a StructBlock
  • ListField - wraps a ListBlock
  • MultipleChoiceField - wraps a MultipleChoiceBlock

Installation

pip install wagtail-block-fields

Usage

StructField

from wagtail.blocks import CharBlock, StructBlock
from wagtail_block_fields import StructField

class AddressBlock(StructBlock):
    street = CharBlock()
    city = CharBlock()
    postal_code = CharBlock()

class MyPage(Page):
    address = StructField(AddressBlock())
    
    contact = StructField([
        ('email', CharBlock()),
        ('phone', CharBlock()),
    ])

ListField

from wagtail.blocks import CharBlock
from wagtail_block_fields import ListField

class MyPage(Page):
    tags = ListField(CharBlock())
    categories = ListField(CharBlock(), min_num=1, max_num=5)
    addresses = ListField(AddressBlock())

MultipleChoiceField

from wagtail_block_fields import MultipleChoiceField

COLOR_CHOICES = [
    ("red", "Red"),
    ("green", "Green"),
    ("blue", "Blue"),
]

class MyPage(Page):
    colors = MultipleChoiceField(choices=COLOR_CHOICES)

In templates

<p>{{ page.address.street }}, {{ page.address.city }}</p>

<ul>
{% for tag in page.tags %}
    <li>{{ tag }}</li>
{% endfor %}
</ul>

<ul>
{% for color in page.colors %}
    <li>{{ color }}</li>
{% endfor %}
</ul>

{% for address in page.addresses %}
    <p>{{ address.street }}, {{ address.city }}</p>
{% endfor %}

Why?

Sometimes you need structured JSON data in a single field without the complexity of StreamField. These fields:

  • Store data as JSON in a single database column
  • Provide full Wagtail admin editing UI
  • Support validation, search indexing, and reference extraction
  • Work with migrations just like StreamField
  • Support nesting (e.g., MultipleChoiceField inside a StructField)

License

MIT

Metadata

Release files for wagtail-block-fields 0.4.0

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

Source distribution (sdist)

Source distribution for wagtail-block-fields 0.4.0
File Size Uploaded Provenance Actions
wagtail_block_fields-0.4.0.tar.gz 48.5 kB With provenance Details for wagtail_block_fields-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-block-fields 0.4.0
File Interpreter ABI Platform Actions
wagtail_block_fields-0.4.0-py3-none-any.whl Python 3 none any Details for wagtail_block_fields-0.4.0-py3-none-any.whl

Total release size: 54.3 kB

Release files / wagtail_block_fields-0.4.0.tar.gz

Download URL wagtail_block_fields-0.4.0.tar.gz
Size 48.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f0bf2c4770a5340853a5aeda7878bddd77a7c3c4e4bbc085ebdd00ea1bdb3b9e
BLAKE2b-256 checksum
How to use checksums
74ebd9a223272e0255a35667f651eb794fee1b3148b13708b972551351bd8fad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / wagtail_block_fields-0.4.0-py3-none-any.whl

Download URL wagtail_block_fields-0.4.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fe1c6d754cee8fbf7b16f5903d1e4bb751d3e9e614ebe3744e0be131b0b000e
BLAKE2b-256 checksum
How to use checksums
4d44a9b36d2002a81838b77c2d97fa282345137e50e1feef7301404acd040b77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Security for wagtail-block-fields 0.4.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for wagtail_block_fields-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

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.

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