Skip to content
Snippets Groups Projects
Commit 6b91fc95 authored by Tomi Valentová's avatar Tomi Valentová
Browse files

run hooks

parent 54fe49f3
Branches
No related tags found
2 merge requests!1121Release,!1119run hooks
Pipeline #19610 passed
Showing
with 414 additions and 71 deletions
...@@ -5,16 +5,21 @@ from django.db import migrations ...@@ -5,16 +5,21 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('elections', '0051_electionsarticlespage_displayed_tags_and_more'), ("elections", "0051_electionsarticlespage_displayed_tags_and_more"),
('shared', '0010_alter_octopusperson_photo'), ("shared", "0010_alter_octopusperson_photo"),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='electionsarticlepage', model_name="electionsarticlepage",
name='shared_tags', name="shared_tags",
field=modelcluster.contrib.taggit.ClusterTaggableManager(blank=True, help_text='A comma-separated list of tags.', through='shared.SharedTaggedElectionsArticle', to='shared.SharedTag', verbose_name='Štítky pro sdílení mezi weby'), field=modelcluster.contrib.taggit.ClusterTaggableManager(
blank=True,
help_text="A comma-separated list of tags.",
through="shared.SharedTaggedElectionsArticle",
to="shared.SharedTag",
verbose_name="Štítky pro sdílení mezi weby",
),
), ),
] ]
...@@ -4,15 +4,18 @@ from django.db import migrations, models ...@@ -4,15 +4,18 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('elections', '0052_alter_electionsarticlepage_shared_tags'), ("elections", "0052_alter_electionsarticlepage_shared_tags"),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='electionsarticlespage', model_name="electionsarticlespage",
name='show_tags', name="show_tags",
field=models.BooleanField(default=True, help_text='Pokud je toto pole zaškrtlé, v hlavičce se zobrazí štítky.', verbose_name='Zobrazit štítky'), field=models.BooleanField(
default=True,
help_text="Pokud je toto pole zaškrtlé, v hlavičce se zobrazí štítky.",
verbose_name="Zobrazit štítky",
),
), ),
] ]
...@@ -5,21 +5,30 @@ from django.db import migrations ...@@ -5,21 +5,30 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('elections', '0053_alter_electionsarticlespage_show_tags'), ("elections", "0053_alter_electionsarticlespage_show_tags"),
('shared', '0010_alter_octopusperson_photo'), ("shared", "0010_alter_octopusperson_photo"),
] ]
operations = [ operations = [
migrations.AddField( migrations.AddField(
model_name='electionsarticlespage', model_name="electionsarticlespage",
name='displayed_shared_tags', name="displayed_shared_tags",
field=modelcluster.fields.ParentalManyToManyField(blank=True, related_name='+', to='shared.sharedtag', verbose_name='Pro sdílení mezi weby'), field=modelcluster.fields.ParentalManyToManyField(
blank=True,
related_name="+",
to="shared.sharedtag",
verbose_name="Pro sdílení mezi weby",
),
), ),
migrations.AlterField( migrations.AlterField(
model_name='electionsarticlespage', model_name="electionsarticlespage",
name='displayed_tags', name="displayed_tags",
field=modelcluster.fields.ParentalManyToManyField(blank=True, related_name='+', to='elections.electionsarticletag', verbose_name='Z tohoto webu'), field=modelcluster.fields.ParentalManyToManyField(
blank=True,
related_name="+",
to="elections.electionsarticletag",
verbose_name="Z tohoto webu",
),
), ),
] ]
...@@ -5,16 +5,20 @@ from django.db import migrations ...@@ -5,16 +5,20 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('elections', '0054_electionsarticlespage_displayed_shared_tags_and_more'), ("elections", "0054_electionsarticlespage_displayed_shared_tags_and_more"),
('shared', '0010_alter_octopusperson_photo'), ("shared", "0010_alter_octopusperson_photo"),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='electionsarticlespage', model_name="electionsarticlespage",
name='displayed_shared_tags', name="displayed_shared_tags",
field=modelcluster.fields.ParentalManyToManyField(blank=True, related_name='+', to='shared.sharedtag', verbose_name='Sdílecí'), field=modelcluster.fields.ParentalManyToManyField(
blank=True,
related_name="+",
to="shared.sharedtag",
verbose_name="Sdílecí",
),
), ),
] ]
# Generated by Django 5.0.7 on 2024-08-27 15:30
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('elections', '0055_alter_electionsarticlespage_displayed_shared_tags'),
]
operations = [
migrations.AlterField(
model_name='electionsfullprogrampage',
name='content',
field=wagtail.fields.StreamField([('richtext', wagtail.blocks.RichTextBlock(label='Text', template='styleguide2/includes/atoms/text/prose_richtext.html')), ('popout_block', wagtail.blocks.StructBlock([('preamble', wagtail.blocks.RichTextBlock(help_text='Zobrazí se nad přepínačem mezi kandidáty a programem.', label='Preambule', required=False)), ('categories', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('name', wagtail.blocks.CharBlock(label='Název')), ('icon', wagtail.images.blocks.ImageChooserBlock(label='Ikona', required=False)), ('description', wagtail.blocks.RichTextBlock(label='Popis', required=False)), ('point_list', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Titulek vyskakovacího bloku')), ('content', wagtail.blocks.RichTextBlock(features=['h3', 'h4', 'h5', 'bold', 'italic', 'ol', 'ul', 'hr', 'link', 'document-link', 'image', 'superscript', 'subscript', 'strikethrough', 'blockquote', 'embed'], label='Obsah')), ('guarantor', wagtail.blocks.PageChooserBlock(label='Garant', page_type=['district.DistrictPersonPage'], required=False))]), label='Jednotlivé bloky programu'))]), label='Kategorie programu'))]))], blank=True, verbose_name='Obsah'),
),
migrations.AlterField(
model_name='electionshomepage',
name='content',
field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('desktop_image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud není vybráno video, ukáže se na desktopu.', label='Obrázek na pozadí (desktop)')), ('mobile_image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud je vybrán, ukáže se místo videa na mobilu.', label='Obrázek (mobil)', required=False)), ('video_url', wagtail.blocks.URLBlock(help_text='Pokud je vybráno, ukáže se na desktopech s povoleným autoplayem místo obrázku.', label='URL videa', required=False)), ('mobile_line_1', wagtail.blocks.TextBlock(label='První mobilní řádek')), ('mobile_line_2', wagtail.blocks.TextBlock(label='Druhý mobilní řádek'))])), ('candidates', 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.RichTextBlock(label='Popis', required=False))]), label=' ', required=False)), ('stream_candidates', wagtail.blocks.StreamBlock([('candidate', wagtail.blocks.StructBlock([('page', wagtail.blocks.PageChooserBlock(label='Stránka')), ('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(label='Popis', required=False))])), ('custom_candidate', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Nadpis')), ('subtitle', wagtail.blocks.CharBlock(label='Podnadpis', required=False)), ('job', wagtail.blocks.CharBlock(label='Povolání', required=False)), ('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(label='Popis', required=False)), ('button_url', wagtail.blocks.URLBlock(label='Odkaz tlačítka', required=False)), ('button_text', wagtail.blocks.CharBlock(default='Zobrazit více', help_text='Pokud není vyplněno, odkaz tlačítka se nezobrazí', label='Text tlačítka', required=False))]))], label=' ', required=False))])), ('secondary_candidates', wagtail.blocks.StructBlock([('heading', wagtail.blocks.CharBlock(default='Ostatní kandidátky', label='Nadpis zbytku kandidátky')), ('candidates', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('number', wagtail.blocks.CharBlock(label='Číslo')), ('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))]), label='Kandidáti'))])), ('program', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(default='Program', help_text="Např. 'Program'", label='Nadpis')), ('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([('content', wagtail.blocks.TextBlock(label='Obsah'))]), label='Body'))]), label='Kategorie')), ('long_version_url', wagtail.blocks.URLBlock(help_text='Pro zobrazení odkazu na celou verzi programu musí být obě následující pole vyplněná.', label='Odkaz na celou verzi programu', required=False)), ('long_version_text', wagtail.blocks.CharBlock(label='Nadpis odkazu na celou verzi programu', required=False))])), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Nejnovější články se načtou automaticky', label='Titulek')), ('description', wagtail.blocks.TextBlock(label='Popis', required=False))], template='styleguide2/includes/organisms/articles/elections/articles_section.html')), ('calendar', wagtail.blocks.StructBlock([('heading', wagtail.blocks.CharBlock(label='Nadpis'))]))], blank=True, verbose_name='Hlavní obsah'),
),
]
# Generated by Django 5.0.7 on 2024-08-27 15:34
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('elections', '0056_alter_electionsfullprogrampage_content_and_more'),
]
operations = [
migrations.AlterField(
model_name='electionshomepage',
name='content',
field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('desktop_image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud není vybráno video, ukáže se na desktopu.', label='Obrázek na pozadí (desktop)')), ('mobile_image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud je vybrán, ukáže se místo videa na mobilu.', label='Obrázek (mobil)', required=False)), ('video_url', wagtail.blocks.URLBlock(help_text='Pokud je vybráno, ukáže se na desktopech s povoleným autoplayem místo obrázku.', label='URL videa', required=False)), ('mobile_line_1', wagtail.blocks.TextBlock(label='První mobilní řádek')), ('mobile_line_2', wagtail.blocks.TextBlock(label='Druhý mobilní řádek'))])), ('candidates', wagtail.blocks.StructBlock([('stream_candidates', wagtail.blocks.StreamBlock([('candidate', wagtail.blocks.StructBlock([('page', wagtail.blocks.PageChooserBlock(label='Stránka')), ('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(label='Popis', required=False))])), ('custom_candidate', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Nadpis')), ('subtitle', wagtail.blocks.CharBlock(label='Podnadpis', required=False)), ('job', wagtail.blocks.CharBlock(label='Povolání', required=False)), ('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(label='Popis', required=False)), ('button_url', wagtail.blocks.URLBlock(label='Odkaz tlačítka', required=False)), ('button_text', wagtail.blocks.CharBlock(default='Zobrazit více', help_text='Pokud není vyplněno, odkaz tlačítka se nezobrazí', label='Text tlačítka', required=False))]))], label=' ', required=False)), ('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.RichTextBlock(label='Popis', required=False))]), label=' ', required=False))])), ('secondary_candidates', wagtail.blocks.StructBlock([('heading', wagtail.blocks.CharBlock(default='Ostatní kandidátky', label='Nadpis zbytku kandidátky')), ('candidates', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('number', wagtail.blocks.CharBlock(label='Číslo')), ('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))]), label='Kandidáti'))])), ('program', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(default='Program', help_text="Např. 'Program'", label='Nadpis')), ('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([('content', wagtail.blocks.TextBlock(label='Obsah'))]), label='Body'))]), label='Kategorie')), ('long_version_url', wagtail.blocks.URLBlock(help_text='Pro zobrazení odkazu na celou verzi programu musí být obě následující pole vyplněná.', label='Odkaz na celou verzi programu', required=False)), ('long_version_text', wagtail.blocks.CharBlock(label='Nadpis odkazu na celou verzi programu', required=False))])), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Nejnovější články se načtou automaticky', label='Titulek')), ('description', wagtail.blocks.TextBlock(label='Popis', required=False))], template='styleguide2/includes/organisms/articles/elections/articles_section.html')), ('calendar', wagtail.blocks.StructBlock([('heading', wagtail.blocks.CharBlock(label='Nadpis'))]))], blank=True, verbose_name='Hlavní obsah'),
),
]
# Generated by Django 5.0.7 on 2024-08-27 16:16
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('elections', '0057_alter_electionshomepage_content'),
]
operations = [
migrations.AlterField(
model_name='electionshomepage',
name='content',
field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('desktop_image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud není vybráno video, ukáže se na desktopu.', label='Obrázek na pozadí (desktop)')), ('mobile_image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud je vybrán, ukáže se místo videa na mobilu.', label='Obrázek (mobil)', required=False)), ('video_url', wagtail.blocks.URLBlock(help_text='Pokud je vybráno, ukáže se na desktopech s povoleným autoplayem místo obrázku.', label='URL videa', required=False)), ('mobile_line_1', wagtail.blocks.TextBlock(label='První mobilní řádek')), ('mobile_line_2', wagtail.blocks.TextBlock(label='Druhý mobilní řádek'))])), ('candidates', wagtail.blocks.StructBlock([('stream_candidates', wagtail.blocks.StreamBlock([('candidate', wagtail.blocks.StructBlock([('page', wagtail.blocks.PageChooserBlock(label='Stránka')), ('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(label='Popis', required=False))])), ('custom_candidate', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Nadpis')), ('subtitle', wagtail.blocks.CharBlock(label='Podnadpis', required=False)), ('job', wagtail.blocks.CharBlock(label='Povolání', required=False)), ('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(label='Popis', required=False)), ('button_url', wagtail.blocks.URLBlock(label='Odkaz tlačítka', required=False)), ('button_text', wagtail.blocks.CharBlock(default='Zjisti více', help_text='Pokud není vyplněno, odkaz tlačítka se nezobrazí', label='Text tlačítka', required=False))]))], label=' ', required=False)), ('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.RichTextBlock(label='Popis', required=False))]), label=' ', required=False))])), ('secondary_candidates', wagtail.blocks.StructBlock([('heading', wagtail.blocks.CharBlock(default='Ostatní kandidátky', label='Nadpis zbytku kandidátky')), ('candidates', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('number', wagtail.blocks.CharBlock(label='Číslo')), ('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))]), label='Kandidáti'))])), ('program', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(default='Program', help_text="Např. 'Program'", label='Nadpis')), ('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([('content', wagtail.blocks.TextBlock(label='Obsah'))]), label='Body'))]), label='Kategorie')), ('long_version_url', wagtail.blocks.URLBlock(help_text='Pro zobrazení odkazu na celou verzi programu musí být obě následující pole vyplněná.', label='Odkaz na celou verzi programu', required=False)), ('long_version_text', wagtail.blocks.CharBlock(label='Nadpis odkazu na celou verzi programu', required=False))])), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Nejnovější články se načtou automaticky', label='Titulek')), ('description', wagtail.blocks.TextBlock(label='Popis', required=False))], template='styleguide2/includes/organisms/articles/elections/articles_section.html')), ('calendar', wagtail.blocks.StructBlock([('heading', wagtail.blocks.CharBlock(label='Nadpis'))]))], blank=True, verbose_name='Hlavní obsah'),
),
]
...@@ -30,7 +30,7 @@ from shared.models import ( # MenuMixin, ...@@ -30,7 +30,7 @@ from shared.models import ( # MenuMixin,
from shared.utils import make_promote_panels from shared.utils import make_promote_panels
from . import blocks from . import blocks
from .forms import JekyllImportForm, ElectionsArticlesPageForm from .forms import ElectionsArticlesPageForm
class ElectionsHomePage(MainHomePageMixin, CalendarMixin): class ElectionsHomePage(MainHomePageMixin, CalendarMixin):
......
from django.utils.text import slugify from django.utils.text import slugify
from wagtail.blocks import ( from wagtail.blocks import (
BooleanBlock,
CharBlock, CharBlock,
ListBlock, ListBlock,
PageChooserBlock, PageChooserBlock,
...@@ -10,15 +11,27 @@ from wagtail.blocks import ( ...@@ -10,15 +11,27 @@ from wagtail.blocks import (
) )
from wagtail.images.blocks import ImageChooserBlock from wagtail.images.blocks import ImageChooserBlock
from shared.blocks import CandidateBlock as SharedCandidateBlockMixin
from shared.blocks import CandidateListBlock
from shared.blocks import CandidateListBlock as SharedCandidateListBlockMixin
from shared.blocks import (
CandidateSecondaryListBlock as SharedCandidateSecondaryListBlockMixin,
)
from shared.blocks import ( from shared.blocks import (
CardLinkBlockMixin, CardLinkBlockMixin,
CardLinkWithHeadlineBlockMixin, CardLinkWithHeadlineBlockMixin,
CarouselProgramBlock,
CustomPrimaryCandidateBlock,
LinkBlock,
PersonBoxBlock, PersonBoxBlock,
PersonContactBlockMixin, PersonContactBlockMixin,
ProgramGroupBlock,
ProgramGroupBlockMixin, ProgramGroupBlockMixin,
) )
from shared.blocks import ProgramGroupBlockPopout as SharedProgramGroupBlockPopout from shared.blocks import ProgramGroupBlockPopout as SharedProgramGroupBlockPopout
from shared.blocks import TeamBlockMixin from shared.blocks import ProgramGroupWithCandidatesOtherViewBlock
from shared.blocks import SecondaryCandidateBlock as SharedSecondaryCandidateBlockMixin
from shared.blocks import StreamBlock, TeamBlockMixin
class CardLinkBlock(CardLinkBlockMixin): class CardLinkBlock(CardLinkBlockMixin):
...@@ -118,7 +131,6 @@ class ProgramGroupBlockCrossroad(ProgramGroupBlockMixin): ...@@ -118,7 +131,6 @@ class ProgramGroupBlockCrossroad(ProgramGroupBlockMixin):
class Meta: class Meta:
icon = "date" icon = "date"
group = "Program"
label = "Rozcestníkový program" label = "Rozcestníkový program"
...@@ -186,7 +198,7 @@ class HoaxBlock(StructBlock): ...@@ -186,7 +198,7 @@ class HoaxBlock(StructBlock):
class Meta: class Meta:
icon = "view" icon = "view"
label = "Hoax" label = "Hoax"
template = "main/blocks/hoax_block.html" template = "styleguide2/includes/molecules/popouts/hoax_popout_point.html"
class TeamBlock(TeamBlockMixin): class TeamBlock(TeamBlockMixin):
...@@ -227,6 +239,112 @@ class PersonContactBlock(PersonContactBlockMixin): ...@@ -227,6 +239,112 @@ class PersonContactBlock(PersonContactBlockMixin):
) )
class CandidateBlock(SharedCandidateBlockMixin):
page = PageChooserBlock(
label="Stránka",
page_type=["district.DistrictPersonPage", "district.DistrictOctopusPersonPage"],
)
class SecondaryCandidateBlock(SharedSecondaryCandidateBlockMixin):
page = PageChooserBlock(
label="Stránka",
page_type=["district.DistrictPersonPage", "district.DistrictOctopusPersonPage"],
)
class CandidateListBlock(SharedCandidateListBlockMixin):
stream_candidates = StreamBlock(
[
("candidate", CandidateBlock()),
("custom_candidate", CustomPrimaryCandidateBlock()),
],
required=False,
label=" ", # Hacky way to show no label
)
class CandidateSecondaryListBlock(SharedCandidateSecondaryListBlockMixin):
candidates = ListBlock(
SecondaryCandidateBlock(),
label="Zbylí kandidáti na listině",
)
class ProgramGroupWithCandidatesBlock(StructBlock):
title = CharBlock(
label="Název programu",
help_text="Např. 'Krajské volby 2024', 'Evropské volby 2024', ...",
)
preamble_content = RichTextBlock(
label="Preambule",
help_text="Text, který se zobrazí před přepínačem mezi kandidáty a programem.",
required=False,
)
show_job = BooleanBlock(
label="Zobrazit povolání",
help_text="Pokud je vybráno, u osob se zobrazí povolání místo stranické pozice.",
default=True,
required=False,
)
primary_candidates = CandidateListBlock(
label="Osoby na čele kandidátky",
help_text="Zobrazí se ve velkých blocích na začátku stránky.",
)
secondary_candidates = CandidateSecondaryListBlock(
label="Ostatní osoby na kandidátce",
help_text="Zobrazí se v kompaktním seznamu pod čelem kandidátky.",
)
program = StreamBlock(
[
("program_group", ProgramGroupBlock()),
("program_group_crossroad", ProgramGroupBlockCrossroad()),
("program_group_popout", ProgramGroupBlockPopout()),
(
"carousel_program",
CarouselProgramBlock(
template="styleguide2/includes/molecules/program/program_block.html"
),
),
],
required=False,
)
other_views = ListBlock(
ProgramGroupWithCandidatesOtherViewBlock(),
label="Ostatní záložky",
min_num=0,
help_text=(
"Použitelné např. pro zobrazení volebních novin na separátní "
"záložce stránky s programem."
),
)
tab_links = ListBlock(
LinkBlock(label="Odkaz"),
label="Odkazy zobrazené jako záložky",
min_num=0,
help_text=(
"Odkazy na jiné části stránky, které se zobrazí jako záložka nahoře."
),
)
class Meta:
icon = "list-ul"
label = "Program s kandidáty"
template = "styleguide2/includes/molecules/program/program_block.html"
def get_prep_value(self, value):
value = super().get_prep_value(value)
value["slug"] = slugify(value["title"])
return value
# --- TODO: Remove legacy blocks used in migrations only # --- TODO: Remove legacy blocks used in migrations only
......
import os import os
import tempfile import tempfile
from shared.forms import JekyllImportForm as SharedJekyllImportForm
from shared.forms import ArticlesPageForm as SharedArticlesPageForm from shared.forms import ArticlesPageForm as SharedArticlesPageForm
from shared.forms import JekyllImportForm as SharedJekyllImportForm
from .tasks import import_jekyll_articles from .tasks import import_jekyll_articles
...@@ -29,16 +29,25 @@ class JekyllImportForm(SharedJekyllImportForm): ...@@ -29,16 +29,25 @@ class JekyllImportForm(SharedJekyllImportForm):
class MainArticlesPageForm(SharedArticlesPageForm, JekyllImportForm): class MainArticlesPageForm(SharedArticlesPageForm, JekyllImportForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
from .models import MainArticleTag
from shared.models import SharedTag from shared.models import SharedTag
from .models import MainArticleTag
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields["shared_tags"].queryset = SharedTag.objects.order_by("name") self.fields["shared_tags"].queryset = SharedTag.objects.order_by("name")
if self.instance.pk: if self.instance.pk:
valid_tag_ids = MainArticleTag.objects.filter( valid_tag_ids = (
MainArticleTag.objects.filter(
content_object__in=self.instance.get_children().specific() content_object__in=self.instance.get_children().specific()
).values_list('tag_id', flat=True).distinct() )
.values_list("tag_id", flat=True)
.distinct()
)
self.fields['displayed_tags'].queryset = MainArticleTag.objects.filter(id__in=valid_tag_ids).order_by("tag__name").distinct("tag__name") self.fields["displayed_tags"].queryset = (
\ No newline at end of file MainArticleTag.objects.filter(id__in=valid_tag_ids)
.order_by("tag__name")
.distinct("tag__name")
)
...@@ -5,20 +5,24 @@ from django.db import migrations, models ...@@ -5,20 +5,24 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('main', '0110_alter_mainarticlepage_content'), ("main", "0110_alter_mainarticlepage_content"),
] ]
operations = [ operations = [
migrations.AddField( migrations.AddField(
model_name='mainarticlespage', model_name="mainarticlespage",
name='displayed_tags', name="displayed_tags",
field=modelcluster.fields.ParentalManyToManyField(blank=True, help_text='Pokud nejsou žádné štítky vybrané, zobrazí se nejpoužívanějších 20.', to='main.mainarticletag', verbose_name='Zobrazené štítky'), field=modelcluster.fields.ParentalManyToManyField(
blank=True,
help_text="Pokud nejsou žádné štítky vybrané, zobrazí se nejpoužívanějších 20.",
to="main.mainarticletag",
verbose_name="Zobrazené štítky",
),
), ),
migrations.AddField( migrations.AddField(
model_name='mainarticlespage', model_name="mainarticlespage",
name='show_tags', name="show_tags",
field=models.BooleanField(default=True, verbose_name='Zobrazit štítky'), field=models.BooleanField(default=True, verbose_name="Zobrazit štítky"),
), ),
] ]
...@@ -5,16 +5,21 @@ from django.db import migrations ...@@ -5,16 +5,21 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('main', '0111_mainarticlespage_displayed_tags_and_more'), ("main", "0111_mainarticlespage_displayed_tags_and_more"),
('shared', '0010_alter_octopusperson_photo'), ("shared", "0010_alter_octopusperson_photo"),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='mainarticlepage', model_name="mainarticlepage",
name='shared_tags', name="shared_tags",
field=modelcluster.contrib.taggit.ClusterTaggableManager(blank=True, help_text='A comma-separated list of tags.', through='shared.SharedTaggedMainArticle', to='shared.SharedTag', verbose_name='Štítky pro sdílení mezi weby'), field=modelcluster.contrib.taggit.ClusterTaggableManager(
blank=True,
help_text="A comma-separated list of tags.",
through="shared.SharedTaggedMainArticle",
to="shared.SharedTag",
verbose_name="Štítky pro sdílení mezi weby",
),
), ),
] ]
...@@ -4,15 +4,18 @@ from django.db import migrations, models ...@@ -4,15 +4,18 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('main', '0112_alter_mainarticlepage_shared_tags'), ("main", "0112_alter_mainarticlepage_shared_tags"),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='mainarticlespage', model_name="mainarticlespage",
name='show_tags', name="show_tags",
field=models.BooleanField(default=True, help_text='Pokud je toto pole zaškrtlé, v hlavičce se zobrazí štítky.', verbose_name='Zobrazit štítky'), field=models.BooleanField(
default=True,
help_text="Pokud je toto pole zaškrtlé, v hlavičce se zobrazí štítky.",
verbose_name="Zobrazit štítky",
),
), ),
] ]
...@@ -5,16 +5,20 @@ from django.db import migrations ...@@ -5,16 +5,20 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('main', '0114_mainarticlespage_displayed_shared_tags_and_more'), ("main", "0114_mainarticlespage_displayed_shared_tags_and_more"),
('shared', '0010_alter_octopusperson_photo'), ("shared", "0010_alter_octopusperson_photo"),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='mainarticlespage', model_name="mainarticlespage",
name='displayed_shared_tags', name="displayed_shared_tags",
field=modelcluster.fields.ParentalManyToManyField(blank=True, related_name='+', to='shared.sharedtag', verbose_name='Sdílecí'), field=modelcluster.fields.ParentalManyToManyField(
blank=True,
related_name="+",
to="shared.sharedtag",
verbose_name="Sdílecí",
),
), ),
] ]
This diff is collapsed.
# Generated by Django 5.0.7 on 2024-08-26 19:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0116_mainprogrampage_perex'),
]
operations = [
migrations.AlterField(
model_name='mainprogrampage',
name='perex',
field=models.TextField(blank=True, help_text='Zobrazí se pod nadpisem', null=True, verbose_name='Perex'),
),
]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment