diff --git a/district/migrations/0047_districtcrossroadpage_content_and_more.py b/district/migrations/0047_districtcrossroadpage_content_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..ac5a0aa02a95aa8686b565f360c89b96a6813705 --- /dev/null +++ b/district/migrations/0047_districtcrossroadpage_content_and_more.py @@ -0,0 +1,84 @@ +# Generated by Django 4.0.3 on 2022-03-25 09:33 + +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", "0046_districtcenterpage_content"), + ] + + operations = [ + migrations.AddField( + model_name="districtcrossroadpage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ( + "people_group", + wagtail.core.blocks.StructBlock( + [ + ( + "group_title", + wagtail.core.blocks.CharBlock( + label="Titulek", required=True + ), + ), + ( + "person_list", + wagtail.core.blocks.ListBlock( + wagtail.core.blocks.PageChooserBlock( + label="Osoba", + page_type=["district.DistrictPersonPage"], + ), + label="List osob", + ), + ), + ] + ), + ) + ], + blank=True, + verbose_name="Obsah stránky", + ), + ), + migrations.AlterField( + model_name="districtcustompage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ("text", wagtail.core.blocks.RichTextBlock()), + ("table", wagtail.contrib.table_block.blocks.TableBlock()), + ( + "people_group", + wagtail.core.blocks.StructBlock( + [ + ( + "group_title", + wagtail.core.blocks.CharBlock( + label="Titulek", required=True + ), + ), + ( + "person_list", + wagtail.core.blocks.ListBlock( + wagtail.core.blocks.PageChooserBlock( + label="Osoba", + page_type=["district.DistrictPersonPage"], + ), + label="List osob", + ), + ), + ] + ), + ), + ], + blank=True, + verbose_name="Obsah", + ), + ), + ] diff --git a/district/models.py b/district/models.py index a672aabace755694f74360d3d1538d04de25469c..7a95be5ab8df5fb7632dd7d3e3c1bdaf94135fc8 100644 --- a/district/models.py +++ b/district/models.py @@ -874,10 +874,19 @@ class DistrictCrossroadPage(SubpageMixin, MetadataPageMixin, Page): blank=True, ) + content = StreamField( + [ + ("people_group", blocks.PeopleGroupListBlock()), + ], + verbose_name="Obsah stránky", + blank=True, + ) + ### PANELS content_panels = Page.content_panels + [ StreamFieldPanel("cards_content"), + StreamFieldPanel("content"), ] ### RELATIONS @@ -912,6 +921,7 @@ class DistrictCustomPage(SubpageMixin, MetadataPageMixin, Page): [ ("text", RichTextBlock()), ("table", TableBlock()), + ("people_group", blocks.PeopleGroupListBlock()), ], verbose_name="Obsah", blank=True, diff --git a/district/templates/district/district_crossroad_page.html b/district/templates/district/district_crossroad_page.html index d628406a73f57c769eee196aa233175335ffaa20..124854669e0de97076f48c73ee06f9740486ef64 100644 --- a/district/templates/district/district_crossroad_page.html +++ b/district/templates/district/district_crossroad_page.html @@ -8,5 +8,10 @@ {% include_block card_block %} {% endfor %} </div> + {% for block in page.content %} + <div class="content-block mb-8"> + {% include_block block %} + </div> + {% endfor %} </main> {% endblock %} diff --git a/region/migrations/0022_regioncrossroadpage_content_and_more.py b/region/migrations/0022_regioncrossroadpage_content_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..c5fcddf36cae493a5eda723d8d9eb195f4e2eb98 --- /dev/null +++ b/region/migrations/0022_regioncrossroadpage_content_and_more.py @@ -0,0 +1,84 @@ +# Generated by Django 4.0.3 on 2022-03-25 09:33 + +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", "0021_regioncenterpage_content"), + ] + + operations = [ + migrations.AddField( + model_name="regioncrossroadpage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ( + "people_group", + wagtail.core.blocks.StructBlock( + [ + ( + "group_title", + wagtail.core.blocks.CharBlock( + label="Titulek", required=True + ), + ), + ( + "person_list", + wagtail.core.blocks.ListBlock( + wagtail.core.blocks.PageChooserBlock( + label="Osoba", + page_type=["region.RegionPersonPage"], + ), + label="List osob", + ), + ), + ] + ), + ) + ], + blank=True, + verbose_name="Obsah stránky", + ), + ), + migrations.AlterField( + model_name="regioncustompage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ("text", wagtail.core.blocks.RichTextBlock()), + ("table", wagtail.contrib.table_block.blocks.TableBlock()), + ( + "people_group", + wagtail.core.blocks.StructBlock( + [ + ( + "group_title", + wagtail.core.blocks.CharBlock( + label="Titulek", required=True + ), + ), + ( + "person_list", + wagtail.core.blocks.ListBlock( + wagtail.core.blocks.PageChooserBlock( + label="Osoba", + page_type=["region.RegionPersonPage"], + ), + label="List osob", + ), + ), + ] + ), + ), + ], + blank=True, + verbose_name="Obsah", + ), + ), + ] diff --git a/region/models.py b/region/models.py index 3bfdb435e40ba34d9f8c247a0873d08f1b7eab2c..25b8a2a9f4e4fc86246854eb9dbb5654f3e1d130 100644 --- a/region/models.py +++ b/region/models.py @@ -867,10 +867,19 @@ class RegionCrossroadPage(SubpageMixin, MetadataPageMixin, Page): blank=True, ) + content = StreamField( + [ + ("people_group", blocks.PeopleGroupListBlock()), + ], + verbose_name="Obsah stránky", + blank=True, + ) + ### PANELS content_panels = Page.content_panels + [ StreamFieldPanel("cards_content"), + StreamFieldPanel("content"), ] ### RELATIONS @@ -905,6 +914,7 @@ class RegionCustomPage(SubpageMixin, MetadataPageMixin, Page): [ ("text", RichTextBlock()), ("table", TableBlock()), + ("people_group", blocks.PeopleGroupListBlock()), ], verbose_name="Obsah", blank=True, diff --git a/region/templates/region/region_crossroad_page.html b/region/templates/region/region_crossroad_page.html index 14c5a89782397749436531244b03e81de4d8b8f1..23294fb89d428a1f8585c5cbb3d9c3087876690a 100644 --- a/region/templates/region/region_crossroad_page.html +++ b/region/templates/region/region_crossroad_page.html @@ -8,5 +8,10 @@ {% include_block card_block %} {% endfor %} </div> + {% for block in page.content %} + <div class="content-block mb-8"> + {% include_block block %} + </div> + {% endfor %} </main> {% endblock %}