diff --git a/district/migrations/0046_districtcenterpage_content.py b/district/migrations/0046_districtcenterpage_content.py new file mode 100644 index 0000000000000000000000000000000000000000..8ccba89bfb218f13762a94834071146fa54a2bc6 --- /dev/null +++ b/district/migrations/0046_districtcenterpage_content.py @@ -0,0 +1,31 @@ +# Generated by Django 4.0.3 on 2022-03-23 09:24 + +import wagtail.contrib.table_block.blocks +import wagtail.core.blocks +import wagtail.core.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "district", + "0045_districthomepage_custom_logo_districthomepage_flickr_and_more", + ), + ] + + operations = [ + migrations.AddField( + model_name="districtcenterpage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ("text", wagtail.core.blocks.RichTextBlock()), + ("table", wagtail.contrib.table_block.blocks.TableBlock()), + ], + blank=True, + verbose_name="Obsah", + ), + ), + ] diff --git a/district/models.py b/district/models.py index f48aa0421d1939b637a8e07e0460be0b499ea84b..a672aabace755694f74360d3d1538d04de25469c 100644 --- a/district/models.py +++ b/district/models.py @@ -812,6 +812,14 @@ class DistrictCenterPage(CalendarMixin, SubpageMixin, MetadataPageMixin, Page): null=True, related_name="+", ) + content = StreamField( + [ + ("text", RichTextBlock()), + ("table", TableBlock()), + ], + verbose_name="Obsah", + blank=True, + ) text = RichTextField("Text", null=True) sidebar_content = StreamField( [("address", blocks.AddressBlock()), ("contact", blocks.CenterContactBlock())], @@ -825,6 +833,7 @@ class DistrictCenterPage(CalendarMixin, SubpageMixin, MetadataPageMixin, Page): FieldPanel("perex"), ImageChooserPanel("background_photo"), FieldPanel("text"), + StreamFieldPanel("content"), FieldPanel("calendar_url"), StreamFieldPanel("sidebar_content"), ] diff --git a/district/templates/district/district_center_page.html b/district/templates/district/district_center_page.html index 788a4f67694c36180307f4b6501d7193b50bd294..920c07d290c13e78da3ba3b84fe0486f210bdf1e 100644 --- a/district/templates/district/district_center_page.html +++ b/district/templates/district/district_center_page.html @@ -22,6 +22,9 @@ <div class="lg:w-3/5 xl:w-2/3"> <div class="content-block"> {{ page.text | richtext }} + {% for block in page.content %} + {% include_block block %} + {% endfor %} </div> {% include "shared/small_calendar_snippet.html" %} </div> diff --git a/region/migrations/0021_regioncenterpage_content.py b/region/migrations/0021_regioncenterpage_content.py new file mode 100644 index 0000000000000000000000000000000000000000..bc782775fe1248c5a68b1ee215a0835370dc3248 --- /dev/null +++ b/region/migrations/0021_regioncenterpage_content.py @@ -0,0 +1,28 @@ +# Generated by Django 4.0.3 on 2022-03-23 09:23 + +import wagtail.contrib.table_block.blocks +import wagtail.core.blocks +import wagtail.core.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("region", "0020_regionhomepage_custom_logo_regionhomepage_flickr_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="regioncenterpage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ("text", wagtail.core.blocks.RichTextBlock()), + ("table", wagtail.contrib.table_block.blocks.TableBlock()), + ], + blank=True, + verbose_name="Obsah", + ), + ), + ] diff --git a/region/models.py b/region/models.py index 8b7ecee30e0af6b01e2acd4efafcc5bbc3fee942..3bfdb435e40ba34d9f8c247a0873d08f1b7eab2c 100644 --- a/region/models.py +++ b/region/models.py @@ -805,6 +805,14 @@ class RegionCenterPage(CalendarMixin, SubpageMixin, MetadataPageMixin, Page): null=True, related_name="+", ) + content = StreamField( + [ + ("text", RichTextBlock()), + ("table", TableBlock()), + ], + verbose_name="Obsah", + blank=True, + ) text = RichTextField("Text", null=True) sidebar_content = StreamField( [("address", blocks.AddressBlock()), ("contact", blocks.CenterContactBlock())], @@ -818,6 +826,7 @@ class RegionCenterPage(CalendarMixin, SubpageMixin, MetadataPageMixin, Page): FieldPanel("perex"), ImageChooserPanel("background_photo"), FieldPanel("text"), + StreamFieldPanel("content"), FieldPanel("calendar_url"), StreamFieldPanel("sidebar_content"), ] diff --git a/region/templates/region/region_center_page.html b/region/templates/region/region_center_page.html index 092cee5ccf38d7c661cee847692a969a8842ad29..42c05775c4880474c6075db208fd24b421ee577b 100644 --- a/region/templates/region/region_center_page.html +++ b/region/templates/region/region_center_page.html @@ -22,6 +22,9 @@ <div class="lg:w-3/5 xl:w-2/3"> <div class="content-block"> {{ page.text | richtext }} + {% for block in page.content %} + {% include_block block %} + {% endfor %} </div> {% include "shared/small_calendar_snippet.html" %} </div>