Working TableBlock (but it would be lot easier using a RawHTMLBlock)

This commit is contained in:
PCoder 2022-07-11 09:32:09 +02:00
parent 57e30e6217
commit 3ff5f1eb50
3 changed files with 40 additions and 8 deletions

View file

@ -50,9 +50,32 @@ class ArticleIndexPage(Page):
'intro_en',
)
table_en = TableBlock()
table_fr = TableBlock()
table_de = TableBlock()
table_en = StreamField(
[
('table_en', TableBlock())
],
null=True,
blank = True,
)
table_de = StreamField(
[
('table_de', TableBlock())
],
null=True,
blank = True,
)
table_fr = StreamField(
[
('table_fr', TableBlock())
],
null=True,
blank = True,
)
#table_en = TableBlock()
#table_fr = TableBlock()
#table_de = TableBlock()
trans_table = TranslatedField(
'table_de',
'table_fr',
@ -83,9 +106,9 @@ class ArticleIndexPage(Page):
FieldPanel('intro_fr'),
FieldPanel('title_en'),
FieldPanel('intro_en'),
#FieldPanel('table_en'),
#FieldPanel('table_fr'),
#FieldPanel('table_de'),
FieldPanel('table_en'),
FieldPanel('table_fr'),
FieldPanel('table_de'),
ImageChooserPanel('feed_image'),
MultiFieldPanel(
[

View file

@ -34,6 +34,14 @@
</div>
{% endfor %}
</div>
<!-- Table content -->
<div class="article-table" role="main">
{% for block in page.trans_table %}
{% if block.block_type == 'table_en' or block.block_type == 'table_fr' or block.block_type == 'table_de' %}
{% include_block block %}
{% endif %}
{% endfor %}
</div>
</div><!-- /container -->
</section>

View file

@ -30,11 +30,12 @@
{% endfor %}
</div>
<h1>Mmmm</h1>
<!-- Table content -->
<div class="article-table" role="main">
{% for block in page.trans_table %}
{% elif block.block_type == 'table' %}
{% if block.block_type == 'table' %}
Inside if
{% include_block block %}
{% endif %}
{% endfor %}