diff --git a/district/blocks.py b/district/blocks.py index b3a58725d95b907bb782786cd30c86abd73f0764..7789d36ba9c734f58e1e7a4b1a48608234c43b54 100644 --- a/district/blocks.py +++ b/district/blocks.py @@ -187,7 +187,10 @@ class HomepageSimpleHeaderBlock(StructBlock): class PeopleGroupListBlock(StructBlock): group_title = CharBlock(label="Titulek", required=True) person_list = ListBlock( - PageChooserBlock(label="Osoba", page_type=["district.DistrictPersonPage"]), + PageChooserBlock( + label="Osoba", + page_type=["district.DistrictPersonPage", "region.RegionPersonPage"], + ), label="List osob", ) diff --git a/district/migrations/0050_alter_districtcrossroadpage_content_and_more.py b/district/migrations/0050_alter_districtcrossroadpage_content_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..bc4743295d14bec471b1debbe6a78d2456f7cf16 --- /dev/null +++ b/district/migrations/0050_alter_districtcrossroadpage_content_and_more.py @@ -0,0 +1,126 @@ +# Generated by Django 4.0.3 on 2022-04-01 10:49 + +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", "0049_alter_districtcrossroadpage_cards_content"), + ] + + operations = [ + migrations.AlterField( + 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", + "region.RegionPersonPage", + ], + ), + 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", + "region.RegionPersonPage", + ], + ), + label="List osob", + ), + ), + ] + ), + ), + ], + blank=True, + verbose_name="Obsah", + ), + ), + migrations.AlterField( + model_name="districtpeoplepage", + 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", + "region.RegionPersonPage", + ], + ), + label="List osob", + ), + ), + ] + ), + ) + ], + blank=True, + verbose_name="Obsah stránky", + ), + ), + ] diff --git a/district/templates/district/blocks/people_group_block.html b/district/templates/district/blocks/people_group_block.html index af30db41a19bfcb342f05f99c967db7aff5b7a8d..3b8131e7ef40081900717f12b2fb9f6baa350a6d 100644 --- a/district/templates/district/blocks/people_group_block.html +++ b/district/templates/district/blocks/people_group_block.html @@ -3,6 +3,6 @@ </h2> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 row-gap-8 col-gap-8"> {% for person_page in self.person_list %} - {% include "shared/person_badge_snippet.html" %} + {% include "shared/person_badge_snippet.html" with person_page=person_page.specific %} {% endfor %} </div> diff --git a/region/blocks.py b/region/blocks.py index 2aa7248289b893ea19857bf35b3fed448469f5e2..95fd1432d49a80e2375f18ab58d0d082bea1fc97 100644 --- a/region/blocks.py +++ b/region/blocks.py @@ -187,7 +187,10 @@ class HomepageSimpleHeaderBlock(StructBlock): class PeopleGroupListBlock(StructBlock): group_title = CharBlock(label="Titulek", required=True) person_list = ListBlock( - PageChooserBlock(label="Osoba", page_type=["region.RegionPersonPage"]), + PageChooserBlock( + label="Osoba", + page_type=["district.DistrictPersonPage", "region.RegionPersonPage"], + ), label="List osob", ) diff --git a/region/migrations/0025_alter_regioncrossroadpage_content_and_more.py b/region/migrations/0025_alter_regioncrossroadpage_content_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..564ad88606de9eb92259943faacbcdb728af1568 --- /dev/null +++ b/region/migrations/0025_alter_regioncrossroadpage_content_and_more.py @@ -0,0 +1,126 @@ +# Generated by Django 4.0.3 on 2022-04-01 10:48 + +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", "0024_alter_regioncrossroadpage_cards_content"), + ] + + operations = [ + migrations.AlterField( + 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=[ + "district.DistrictPersonPage", + "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=[ + "district.DistrictPersonPage", + "region.RegionPersonPage", + ], + ), + label="List osob", + ), + ), + ] + ), + ), + ], + blank=True, + verbose_name="Obsah", + ), + ), + migrations.AlterField( + model_name="regionpeoplepage", + 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", + "region.RegionPersonPage", + ], + ), + label="List osob", + ), + ), + ] + ), + ) + ], + blank=True, + verbose_name="Obsah stránky", + ), + ), + ] diff --git a/region/templates/region/blocks/people_group_block.html b/region/templates/region/blocks/people_group_block.html index af30db41a19bfcb342f05f99c967db7aff5b7a8d..3b8131e7ef40081900717f12b2fb9f6baa350a6d 100644 --- a/region/templates/region/blocks/people_group_block.html +++ b/region/templates/region/blocks/people_group_block.html @@ -3,6 +3,6 @@ </h2> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 row-gap-8 col-gap-8"> {% for person_page in self.person_list %} - {% include "shared/person_badge_snippet.html" %} + {% include "shared/person_badge_snippet.html" with person_page=person_page.specific %} {% endfor %} </div>