When a ListBlock contains an ImageChooserBlock or a DocumentChooserBlock, function widget_from_block returns {"type": "unknown"} because content_components is None
Possible solution:
Add an extra elif statement that checks if the block is an instance of a ListBlock and content_components is None:
if isinstance(block, blocks.PageChooserBlock):
...
elif isinstance(block, blocks.ListBlock) and content_components is not None:
return widget_from_block(block.child_block, content_components[1:])
# add this
elif isinstance(block, blocks.ListBlock) and content_components is None:
return widget_from_block(block.child_block)
When a
ListBlock
contains anImageChooserBlock
or aDocumentChooserBlock
, functionwidget_from_block
returns{"type": "unknown"}
becausecontent_components
isNone
Model:
Possible solution: Add an extra elif statement that checks if the block is an instance of a
ListBlock
andcontent_components
isNone
: