Metadata-Version: 2.4
Name: wagtail-flexible-streamfield
Version: 0.2.0
Summary: A Wagtail StreamField that doesn't create migrations when block configurations change
Author: Aidas Bendoraitis
Author-email: Aidas Bendoraitis <aidas@bendoraitis.lt>
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Framework :: Django :: 6.1
Classifier: Framework :: Wagtail
Classifier: Framework :: Wagtail :: 8
Requires-Dist: django>=5.2
Requires-Dist: wagtail>=8.0
Requires-Dist: pytest-django ; extra == 'dev'
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/archatas/wagtail-flexible-streamfield
Project-URL: Issues, https://github.com/archatas/wagtail-flexible-streamfield/issues
Provides-Extra: dev
Description-Content-Type: text/markdown

# wagtail-flexible-streamfield

[![PyPI version](https://img.shields.io/pypi/v/wagtail-flexible-streamfield)](https://pypi.org/project/wagtail-flexible-streamfield/)
![License](https://img.shields.io/pypi/l/wagtail-flexible-streamfield)
![Python versions](https://img.shields.io/pypi/pyversions/wagtail-flexible-streamfield)

A Wagtail `StreamField` subclass that doesn't create new migrations when block configurations change.

## Installation

```bash
pip install wagtail-flexible-streamfield
```

Add `wagtail_flexible_streamfield` to `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
    ...
    "wagtail_flexible_streamfield",
]
```

## Usage

Replace `from wagtail.fields import StreamField` with the package's import:

```python
from wagtail_flexible_streamfield.fields import StreamField

class MyPage(Page):
    content = StreamField([
        ("text", CharBlock()),
        ("rich_text", RichTextBlock()),
    ], blank=True)
```

A single migration is created when you first add the field. After that, adding, removing, or modifying blocks never requires a new migration — the field's `deconstruct()` output is always identical regardless of the block configuration.

## How it works

Wagtail's default `StreamField.deconstruct()` records every block definition in the migration file. This package overrides `deconstruct()` to store an empty `block_lookup` instead, so Django's migration autodetector never sees a change when blocks are updated.

`__init__()` is also overridden to accept calls with no block arguments (the form Django uses when reconstructing the field from a migration), and `to_python()` is overridden to return a useful lazy `StreamValue` when block definitions are unavailable at migration time.
