2👍
This is a consequence of the fact that you’ve placed the TableBlock inside a StructBlock. The full details of this are quite tricky (and explained in detail in the Wagtail docs), but the short version is that when you access the individual fields of a StructBlock (which happens as part of the built-in rendering of StructBlock when you call {% include_block block %}
on it), it only gives you the underlying data of that block (for example, a string for a CharBlock, or the data dictionary you saw for a TableBlock), not the complete block object that knows how to render that data as HTML.
A StructBlock with only one field in it doesn’t really serve a useful purpose, so the more straightforward fix is to use TableBlock
directly in your StreamField instead:
table = StreamField(
[
('table_horaire', TableBlock(table_options=new_table_options))
],
null=True,
blank = True,
)
But if you need the StructBlock there for some other reason, you can access the table
field within it as a complete renderable block by going through bound_blocks
:
{% for block in page.table %}
{% if block.block_type == 'table_horaire' %}
{% include_block block.bound_blocks.table %}
{% endif %}
{% endfor %}
0👍
You code doesnt seem right and has mistake. Below corrected one:
{% for block in page.table %}
{% if block.block_type == 'table_horaire' %}
{% include_block value.bound_blocks.table %}
{% endif %}
{% endfor %}
Anyway thank you for you reply.