Wagtail 4.1 introduces the ReferenceIndex and functionality for tracking object usage in StreamFields. When Wagtail attempts to extract references from a StreamField that contains a ListBlock, it expects the value of the bound list block to be a ListValue.
This PR changes the ListBlockFactory so it returns a ListValue on Wagtail >= 2.16 (the version which introduced ListValue), and updates the tests to accomodate.
Note: there's still an issue with passing a list directly to a StreamField for a ListBlock value, e.g.:
Wagtail won't currently "upcast" the list to a ListValue. As this is Wagtail behaviour it's not something we can/should fix here. If creating list values using the nested fields syntax, a ListValue will be created, e.g:
Fixes #65
Wagtail 4.1 introduces the
ReferenceIndex
and functionality for tracking object usage inStreamFields
. When Wagtail attempts to extract references from aStreamField
that contains aListBlock
, it expects the value of the bound list block to be aListValue
.This PR changes the
ListBlockFactory
so it returns aListValue
on Wagtail >= 2.16 (the version which introducedListValue
), and updates the tests to accomodate.Note: there's still an issue with passing a list directly to a
StreamField
for aListBlock
value, e.g.:Wagtail won't currently "upcast" the list to a
ListValue
. As this is Wagtail behaviour it's not something we can/should fix here. If creating list values using the nested fields syntax, aListValue
will be created, e.g:An alternative is to create a
ListValue
yourself: