diff --git a/elections/blocks.py b/elections/blocks.py index dca84ab9403cd28b37d5cbac1b78eddcf6f2d19a..dc23245e2753e03271056c74821dcab09068bc8a 100644 --- a/elections/blocks.py +++ b/elections/blocks.py @@ -1,14 +1,14 @@ -from wagtail.blocks import StructBlock -from wagtail.images.blocks import ImageChooserBlock from wagtail.blocks import ( - RichTextBlock, - TextBlock, CharBlock, IntegerBlock, + ListBlock, PageChooserBlock, + RichTextBlock, + StructBlock, + TextBlock, URLBlock, - ListBlock ) +from wagtail.images.blocks import ImageChooserBlock class ElectionsCarouselBlock(StructBlock): @@ -22,22 +22,19 @@ class ElectionsCarouselBlock(StructBlock): class CandidateBlock(StructBlock): page = PageChooserBlock( - label="Stránka", - page_type=[ - "elections.ElectionsCandidatePage" - ] + label="Stránka", page_type=["elections.ElectionsCandidatePage"] ) image = ImageChooserBlock( label="Obrázek", help_text="Pokud není vybrán, použije se obrázek ze stránky kandidáta", - required=False + required=False, ) description = TextBlock( label="Popis", required=False, - help_text="Pokud zůstane prázdné, použije se popis ze stránky kandidáta" + help_text="Pokud zůstane prázdné, použije se popis ze stránky kandidáta", ) class Meta: @@ -69,18 +66,11 @@ class ProgramCategoryItemBlock(StructBlock): class ProgramCategoryBlock(StructBlock): - number = IntegerBlock( - label="Číslo" - ) + number = IntegerBlock(label="Číslo") - name = CharBlock( - label="Název" - ) + name = CharBlock(label="Název") - points = ListBlock( - ProgramCategoryItemBlock(), - label="Body" - ) + points = ListBlock(ProgramCategoryItemBlock(), label="Body") class Meta: icon = "form" @@ -88,10 +78,7 @@ class ProgramCategoryBlock(StructBlock): class ProgramBlock(StructBlock): - categories = ListBlock( - ProgramCategoryBlock(), - label="Kategorie" - ) + categories = ListBlock(ProgramCategoryBlock(), label="Kategorie") long_version_url = URLBlock(label="Odkaz na celou verzi programu") long_version_text = CharBlock(label="Nadpis odkazu na celou verzi programu") diff --git a/elections/migrations/0007_alter_electionshomepage_content_and_more.py b/elections/migrations/0007_alter_electionshomepage_content_and_more.py index 28a0b9bed337617168e83b51bcef3b32694cd633..153fdd0a1ab3a0fb118d39e472ee305afadeb96d 100644 --- a/elections/migrations/0007_alter_electionshomepage_content_and_more.py +++ b/elections/migrations/0007_alter_electionshomepage_content_and_more.py @@ -1,60 +1,273 @@ # Generated by Django 4.1.10 on 2024-01-05 16:23 -from django.db import migrations, models import django.db.models.deletion -import shared.models.base import wagtail.blocks import wagtail.fields import wagtail.images.blocks import wagtailmetadata.models +from django.db import migrations, models +import shared.models.base -class Migration(migrations.Migration): +class Migration(migrations.Migration): dependencies = [ - ('wagtailcore', '0083_workflowcontenttype'), - ('calendar_utils', '0004_auto_20220505_1228'), - ('wagtailimages', '0025_alter_image_file_alter_rendition_file'), - ('elections', '0006_alter_electionshomepage_content'), + ("wagtailcore", "0083_workflowcontenttype"), + ("calendar_utils", "0004_auto_20220505_1228"), + ("wagtailimages", "0025_alter_image_file_alter_rendition_file"), + ("elections", "0006_alter_electionshomepage_content"), ] operations = [ migrations.AlterField( - model_name='electionshomepage', - name='content', - field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek na pozadí'))])), ('candidate', wagtail.blocks.StructBlock([('candidates', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('candidate', wagtail.blocks.PageChooserBlock(label='Stránka', page_type=['elections.ElectionsCandidatePage'])), ('description', wagtail.blocks.RichTextBlock(help_text='Pokud zůstane prázdné, použije se popis ze stránky kandidáta', label='Popis', required=False))]), label='Kandidáti'))]))], blank=True, use_json_field=True, verbose_name='Hlavní obsah'), + model_name="electionshomepage", + name="content", + field=wagtail.fields.StreamField( + [ + ( + "carousel", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Obrázek na pozadí" + ), + ) + ] + ), + ), + ( + "candidate", + wagtail.blocks.StructBlock( + [ + ( + "candidates", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "candidate", + wagtail.blocks.PageChooserBlock( + label="Stránka", + page_type=[ + "elections.ElectionsCandidatePage" + ], + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + help_text="Pokud zůstane prázdné, použije se popis ze stránky kandidáta", + label="Popis", + required=False, + ), + ), + ] + ), + label="Kandidáti", + ), + ) + ] + ), + ), + ], + blank=True, + use_json_field=True, + verbose_name="Hlavní obsah", + ), ), migrations.CreateModel( - name='ElectionsCandidatesPage', + name="ElectionsCandidatesPage", fields=[ - ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), - ('calendar_url', models.URLField(blank=True, help_text='Kalendář se po uložení stránky aktualizuje na pozadí. U plnějších kalendářů to může trvat i desítky sekund.', null=True, verbose_name='URL kalendáře ve formátu iCal')), - ('calendar', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='calendar_utils.calendar')), - ('search_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Search image')), + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.page", + ), + ), + ( + "calendar_url", + models.URLField( + blank=True, + help_text="Kalendář se po uložení stránky aktualizuje na pozadí. U plnějších kalendářů to může trvat i desítky sekund.", + null=True, + verbose_name="URL kalendáře ve formátu iCal", + ), + ), + ( + "calendar", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="calendar_utils.calendar", + ), + ), + ( + "search_image", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="wagtailimages.image", + verbose_name="Search image", + ), + ), ], options={ - 'verbose_name': 'Kandidáti', + "verbose_name": "Kandidáti", }, - bases=(shared.models.base.SubpageMixin, wagtailmetadata.models.WagtailImageMetadataMixin, 'wagtailcore.page', models.Model), + bases=( + shared.models.base.SubpageMixin, + wagtailmetadata.models.WagtailImageMetadataMixin, + "wagtailcore.page", + models.Model, + ), ), migrations.CreateModel( - name='ElectionsCandidatePage', + name="ElectionsCandidatePage", fields=[ - ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), - ('calendar_url', models.URLField(blank=True, help_text='Kalendář se po uložení stránky aktualizuje na pozadí. U plnějších kalendářů to může trvat i desítky sekund.', null=True, verbose_name='URL kalendáře ve formátu iCal')), - ('position', models.CharField(blank=True, max_length=64, null=True, verbose_name='Pozice/povolání')), - ('perex', wagtail.fields.RichTextField()), - ('email', models.CharField(blank=True, max_length=128, null=True, verbose_name='E-mail')), - ('phone', models.CharField(blank=True, max_length=16, null=True, verbose_name='Telefonní kontakt')), - ('social_links', wagtail.fields.StreamField([('social_links', wagtail.blocks.StructBlock([('text', wagtail.blocks.CharBlock(label='Název')), ('link', wagtail.blocks.URLBlock(label='Odkaz')), ('icon', wagtail.blocks.CharBlock(help_text='Seznam ikon - https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons <br/>Název ikony zadejte bez tečky na začátku', label='Ikona'))]))], blank=True, use_json_field=True, verbose_name='Odkazy na sociální sítě')), - ('related_candidates', wagtail.fields.StreamField([('candidate', wagtail.blocks.PageChooserBlock(label='Detail kandidáta', page_type=['elections.ElectionsCandidatePage']))], blank=True, use_json_field=True, verbose_name='Další kandidáti')), - ('calendar', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='calendar_utils.calendar')), - ('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailimages.image', verbose_name='Obrázek')), - ('search_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Search image')), + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.page", + ), + ), + ( + "calendar_url", + models.URLField( + blank=True, + help_text="Kalendář se po uložení stránky aktualizuje na pozadí. U plnějších kalendářů to může trvat i desítky sekund.", + null=True, + verbose_name="URL kalendáře ve formátu iCal", + ), + ), + ( + "position", + models.CharField( + blank=True, + max_length=64, + null=True, + verbose_name="Pozice/povolání", + ), + ), + ("perex", wagtail.fields.RichTextField()), + ( + "email", + models.CharField( + blank=True, max_length=128, null=True, verbose_name="E-mail" + ), + ), + ( + "phone", + models.CharField( + blank=True, + max_length=16, + null=True, + verbose_name="Telefonní kontakt", + ), + ), + ( + "social_links", + wagtail.fields.StreamField( + [ + ( + "social_links", + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(label="Název"), + ), + ( + "link", + wagtail.blocks.URLBlock(label="Odkaz"), + ), + ( + "icon", + wagtail.blocks.CharBlock( + help_text="Seznam ikon - https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons <br/>Název ikony zadejte bez tečky na začátku", + label="Ikona", + ), + ), + ] + ), + ) + ], + blank=True, + use_json_field=True, + verbose_name="Odkazy na sociální sítě", + ), + ), + ( + "related_candidates", + wagtail.fields.StreamField( + [ + ( + "candidate", + wagtail.blocks.PageChooserBlock( + label="Detail kandidáta", + page_type=["elections.ElectionsCandidatePage"], + ), + ) + ], + blank=True, + use_json_field=True, + verbose_name="Další kandidáti", + ), + ), + ( + "calendar", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="calendar_utils.calendar", + ), + ), + ( + "image", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="wagtailimages.image", + verbose_name="Obrázek", + ), + ), + ( + "search_image", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="wagtailimages.image", + verbose_name="Search image", + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, - bases=(shared.models.base.SubpageMixin, wagtailmetadata.models.WagtailImageMetadataMixin, 'wagtailcore.page', models.Model), + bases=( + shared.models.base.SubpageMixin, + wagtailmetadata.models.WagtailImageMetadataMixin, + "wagtailcore.page", + models.Model, + ), ), ] diff --git a/elections/migrations/0008_alter_electionsarticlepage_author_page.py b/elections/migrations/0008_alter_electionsarticlepage_author_page.py index 438bc8439b09b74748f0353b00e79061c358e7c1..11b8cd8b0caa6038d47435395161b489574298cc 100644 --- a/elections/migrations/0008_alter_electionsarticlepage_author_page.py +++ b/elections/migrations/0008_alter_electionsarticlepage_author_page.py @@ -1,19 +1,24 @@ # Generated by Django 4.1.10 on 2024-01-05 17:20 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('elections', '0007_alter_electionshomepage_content_and_more'), + ("elections", "0007_alter_electionshomepage_content_and_more"), ] operations = [ migrations.AlterField( - model_name='electionsarticlepage', - name='author_page', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='elections.electionscandidatepage', verbose_name='Stránka autora (kandidáta)'), + model_name="electionsarticlepage", + name="author_page", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="elections.electionscandidatepage", + verbose_name="Stránka autora (kandidáta)", + ), ), ] diff --git a/elections/migrations/0009_electionscandidatepage_articles_heading.py b/elections/migrations/0009_electionscandidatepage_articles_heading.py index 404a7d40204b37362468771c8c76de120ae84931..5083cb6070ef367511073af5ab70445ad58742ae 100644 --- a/elections/migrations/0009_electionscandidatepage_articles_heading.py +++ b/elections/migrations/0009_electionscandidatepage_articles_heading.py @@ -4,16 +4,20 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('elections', '0008_alter_electionsarticlepage_author_page'), + ("elections", "0008_alter_electionsarticlepage_author_page"), ] operations = [ migrations.AddField( - model_name='electionscandidatepage', - name='articles_heading', - field=models.CharField(default='Aktuality', help_text='Např. "Aktuality Mikuláše Peksy".', max_length=32, verbose_name='Nadpis sekce s články'), + model_name="electionscandidatepage", + name="articles_heading", + field=models.CharField( + default="Aktuality", + help_text='Např. "Aktuality Mikuláše Peksy".', + max_length=32, + verbose_name="Nadpis sekce s články", + ), preserve_default=False, ), ] diff --git a/elections/migrations/0010_alter_electionscandidatepage_options_and_more.py b/elections/migrations/0010_alter_electionscandidatepage_options_and_more.py index 84e1ed74e25744bddb2923ff5e0aedb0d97aaad2..d1717aedd69ecd0be008420d31948ed4ddda6b37 100644 --- a/elections/migrations/0010_alter_electionscandidatepage_options_and_more.py +++ b/elections/migrations/0010_alter_electionscandidatepage_options_and_more.py @@ -1,25 +1,85 @@ # Generated by Django 4.1.10 on 2024-01-05 17:35 -from django.db import migrations import wagtail.blocks import wagtail.fields import wagtail.images.blocks +from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('elections', '0009_electionscandidatepage_articles_heading'), + ("elections", "0009_electionscandidatepage_articles_heading"), ] operations = [ migrations.AlterModelOptions( - name='electionscandidatepage', - options={'verbose_name': 'Kandidát'}, + name="electionscandidatepage", + options={"verbose_name": "Kandidát"}, ), migrations.AlterField( - model_name='electionshomepage', - name='content', - field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek na pozadí'))])), ('candidate', wagtail.blocks.StructBlock([('candidates', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('candidate', wagtail.blocks.PageChooserBlock(label='Stránka', page_type=['elections.ElectionsCandidatePage'])), ('image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud není vybrán, použije se obrázek ze stránky kandidáta', label='Obrázek', required=False)), ('description', wagtail.blocks.RichTextBlock(help_text='Pokud zůstane prázdné, použije se popis ze stránky kandidáta', label='Popis', required=False))]), label='Kandidáti'))]))], blank=True, use_json_field=True, verbose_name='Hlavní obsah'), + model_name="electionshomepage", + name="content", + field=wagtail.fields.StreamField( + [ + ( + "carousel", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Obrázek na pozadí" + ), + ) + ] + ), + ), + ( + "candidate", + wagtail.blocks.StructBlock( + [ + ( + "candidates", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "candidate", + wagtail.blocks.PageChooserBlock( + label="Stránka", + page_type=[ + "elections.ElectionsCandidatePage" + ], + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Pokud není vybrán, použije se obrázek ze stránky kandidáta", + label="Obrázek", + required=False, + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + help_text="Pokud zůstane prázdné, použije se popis ze stránky kandidáta", + label="Popis", + required=False, + ), + ), + ] + ), + label="Kandidáti", + ), + ) + ] + ), + ), + ], + blank=True, + use_json_field=True, + verbose_name="Hlavní obsah", + ), ), ] diff --git a/elections/migrations/0011_alter_electionshomepage_content.py b/elections/migrations/0011_alter_electionshomepage_content.py index b76c7da07a4b9f4e859ca1a4c5bcdfa8e2c45f48..4989009736320126cd49f09546693d62cd83a2f5 100644 --- a/elections/migrations/0011_alter_electionshomepage_content.py +++ b/elections/migrations/0011_alter_electionshomepage_content.py @@ -1,21 +1,81 @@ # Generated by Django 4.1.10 on 2024-01-05 17:44 -from django.db import migrations import wagtail.blocks import wagtail.fields import wagtail.images.blocks +from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('elections', '0010_alter_electionscandidatepage_options_and_more'), + ("elections", "0010_alter_electionscandidatepage_options_and_more"), ] operations = [ migrations.AlterField( - model_name='electionshomepage', - name='content', - field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek na pozadí'))])), ('candidate', wagtail.blocks.StructBlock([('candidates', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('page', wagtail.blocks.PageChooserBlock(label='Stránka', page_type=['elections.ElectionsCandidatePage'])), ('image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud není vybrán, použije se obrázek ze stránky kandidáta', label='Obrázek', required=False)), ('description', wagtail.blocks.TextBlock(help_text='Pokud zůstane prázdné, použije se popis ze stránky kandidáta', label='Popis', required=False))]), label='Kandidáti'))]))], blank=True, use_json_field=True, verbose_name='Hlavní obsah'), + model_name="electionshomepage", + name="content", + field=wagtail.fields.StreamField( + [ + ( + "carousel", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Obrázek na pozadí" + ), + ) + ] + ), + ), + ( + "candidate", + wagtail.blocks.StructBlock( + [ + ( + "candidates", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Stránka", + page_type=[ + "elections.ElectionsCandidatePage" + ], + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Pokud není vybrán, použije se obrázek ze stránky kandidáta", + label="Obrázek", + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="Pokud zůstane prázdné, použije se popis ze stránky kandidáta", + label="Popis", + required=False, + ), + ), + ] + ), + label="Kandidáti", + ), + ) + ] + ), + ), + ], + blank=True, + use_json_field=True, + verbose_name="Hlavní obsah", + ), ), ] diff --git a/elections/migrations/0012_alter_electionshomepage_content.py b/elections/migrations/0012_alter_electionshomepage_content.py index f87db9df5a56ee52b0a73dd5c7e73487018f55c7..2d3dec21beaf84c4c15f83af0c366dc1b090d3b6 100644 --- a/elections/migrations/0012_alter_electionshomepage_content.py +++ b/elections/migrations/0012_alter_electionshomepage_content.py @@ -1,21 +1,144 @@ # Generated by Django 4.1.10 on 2024-01-05 19:47 -from django.db import migrations import wagtail.blocks import wagtail.fields import wagtail.images.blocks +from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('elections', '0011_alter_electionshomepage_content'), + ("elections", "0011_alter_electionshomepage_content"), ] operations = [ migrations.AlterField( - model_name='electionshomepage', - name='content', - field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek na pozadí'))])), ('candidate', wagtail.blocks.StructBlock([('candidates', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('page', wagtail.blocks.PageChooserBlock(label='Stránka', page_type=['elections.ElectionsCandidatePage'])), ('image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud není vybrán, použije se obrázek ze stránky kandidáta', label='Obrázek', required=False)), ('description', wagtail.blocks.TextBlock(help_text='Pokud zůstane prázdné, použije se popis ze stránky kandidáta', label='Popis', required=False))]), label='Kandidáti'))])), ('program', wagtail.blocks.StructBlock([('categories', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('number', wagtail.blocks.IntegerBlock(label='Číslo')), ('name', wagtail.blocks.CharBlock(label='Název')), ('points', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('number', wagtail.blocks.IntegerBlock(label='Číslo')), ('content', wagtail.blocks.RichTextBlock(label='Obsah'))]), label='Body'))]), label='Kategorie')), ('long_version_url', wagtail.blocks.URLBlock(label='Odkaz na celou verzi programu')), ('long_version_text', wagtail.blocks.CharBlock(label='Nadpis odkazu na celou verzi programu'))]))], blank=True, use_json_field=True, verbose_name='Hlavní obsah'), + model_name="electionshomepage", + name="content", + field=wagtail.fields.StreamField( + [ + ( + "carousel", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Obrázek na pozadí" + ), + ) + ] + ), + ), + ( + "candidate", + wagtail.blocks.StructBlock( + [ + ( + "candidates", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Stránka", + page_type=[ + "elections.ElectionsCandidatePage" + ], + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Pokud není vybrán, použije se obrázek ze stránky kandidáta", + label="Obrázek", + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="Pokud zůstane prázdné, použije se popis ze stránky kandidáta", + label="Popis", + required=False, + ), + ), + ] + ), + label="Kandidáti", + ), + ) + ] + ), + ), + ( + "program", + wagtail.blocks.StructBlock( + [ + ( + "categories", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "number", + wagtail.blocks.IntegerBlock( + label="Číslo" + ), + ), + ( + "name", + wagtail.blocks.CharBlock( + label="Název" + ), + ), + ( + "points", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "number", + wagtail.blocks.IntegerBlock( + label="Číslo" + ), + ), + ( + "content", + wagtail.blocks.RichTextBlock( + label="Obsah" + ), + ), + ] + ), + label="Body", + ), + ), + ] + ), + label="Kategorie", + ), + ), + ( + "long_version_url", + wagtail.blocks.URLBlock( + label="Odkaz na celou verzi programu" + ), + ), + ( + "long_version_text", + wagtail.blocks.CharBlock( + label="Nadpis odkazu na celou verzi programu" + ), + ), + ] + ), + ), + ], + blank=True, + use_json_field=True, + verbose_name="Hlavní obsah", + ), ), ] diff --git a/elections/models.py b/elections/models.py index 6e3b52c4b1d67c77c9c607e4d930a82b74263764..225d319832e75e7a4e46fe80c3c20294683d0c3d 100644 --- a/elections/models.py +++ b/elections/models.py @@ -57,7 +57,12 @@ class ElectionsHomePage(MainHomePageMixin): ("carousel", blocks.ElectionsCarouselBlock()), ("candidate", blocks.CandidateListBlock()), ("program", blocks.ProgramBlock()), - ("news", shared_blocks.NewsBlock(template="styleguide2/includes/organisms/articles/elections/articles_section.html")), + ( + "news", + shared_blocks.NewsBlock( + template="styleguide2/includes/organisms/articles/elections/articles_section.html" + ), + ), ], verbose_name="Hlavní obsah", blank=True, @@ -194,9 +199,7 @@ class ElectionsCandidatePage( related_name="+", ) - position = models.CharField( - "Pozice/povolání", max_length=64, blank=True, null=True - ) + position = models.CharField("Pozice/povolání", max_length=64, blank=True, null=True) perex = RichTextField() @@ -215,14 +218,17 @@ class ElectionsCandidatePage( articles_heading = models.CharField( "Nadpis sekce s články", max_length=32, - help_text="Např. \"Aktuality Mikuláše Peksy\"." + help_text='Např. "Aktuality Mikuláše Peksy".', ) related_candidates = StreamField( [ ( "candidate", - PageChooserBlock(page_type="elections.ElectionsCandidatePage", label="Detail kandidáta"), + PageChooserBlock( + page_type="elections.ElectionsCandidatePage", + label="Detail kandidáta", + ), ) ], verbose_name="Další kandidáti", diff --git a/main/models.py b/main/models.py index 9b2f29f5bf01fea6f6917c0006ce57f69b0aba12..c120f0404b5e83901ee04bc0002af366b2987715 100644 --- a/main/models.py +++ b/main/models.py @@ -55,7 +55,12 @@ class MainHomePage(MainHomePageMixin): content = StreamField( [ ("carousel", blocks.HomePageCarouseSlideBlock()), - ("news", shared_blocks.NewsBlock(template="styleguide2/includes/organisms/articles/articles_section.html")), + ( + "news", + shared_blocks.NewsBlock( + template="styleguide2/includes/organisms/articles/articles_section.html" + ), + ), ("europarl_news", blocks.EuroparlNewsBlock()), ("people", blocks.PeopleOverviewBlock()), ("regions", blocks.RegionsBlock()),