Renaming Wagtail StreamField

57 Views Asked by At

Starting in Wagtail 4.2, we have some helper classes to assist with data migrations involving StreamFields. For example, Wagtail's documentation here:

https://docs.wagtail.org/en/stable/advanced_topics/streamfield_migrations.html#basic-usage

has an example of a BlogPage class like this:

class BlogPage(Page):
    content = StreamField([
        ("stream1", blocks.StreamBlock([
            ("field1", blocks.CharBlock())
        ])),
    ])

The documentation then covers how to use the new classes to rename the "field1" block to something else...

But my question is, what if you want to change the name of the parent block ("stream1" in this example)? Simply renaming it and generating a database migration seems to erase my data rather than renaming its block type.

Anybody know whether this is possible either using Wagtail's new helper classes or otherwise?

0

There are 0 best solutions below