diff --git a/elections2021/management/commands/export_program.py b/elections2021/management/commands/export_program.py index 5a2990802a6f81552a5e95055f68d44fa7ca8224..0f1065d2acee353199e38a6ad295f7c3fc20843a 100644 --- a/elections2021/management/commands/export_program.py +++ b/elections2021/management/commands/export_program.py @@ -1,4 +1,6 @@ import re +from datetime import date +from io import BytesIO from pathlib import Path from django.core.management.base import BaseCommand, CommandError @@ -107,11 +109,14 @@ def fancy_export(output_file): content = render_to_string( "elections2021/export_program_fancy.html", {"points": points} ) + today = date.today().strftime("%d.%m.%Y") + extra_css = '@page { @bottom-left { content: "%s" }}' % today font_config = FontConfiguration() html = HTML(string=content, url_fetcher=local_fetcher) css = CSS(str(STATICS_DIR / "style.css"), font_config=font_config) - document = html.render(stylesheets=[css], font_config=font_config) + css2 = CSS(BytesIO(extra_css.encode("utf-8")), font_config=font_config) + document = html.render(stylesheets=[css, css2], font_config=font_config) document.write_pdf(tmp_file) merger = PdfFileMerger() diff --git a/elections2021/migrations/0034_auto_20210715_2354.py b/elections2021/migrations/0034_auto_20210715_2354.py new file mode 100644 index 0000000000000000000000000000000000000000..34c6d8e3dbc60536afaff2cfaa8c2624bb6567e6 --- /dev/null +++ b/elections2021/migrations/0034_auto_20210715_2354.py @@ -0,0 +1,115 @@ +# Generated by Django 3.2.5 on 2021-07-15 21:54 + +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("elections2021", "0033_elections2021governmentteampage"), + ] + + operations = [ + migrations.AlterField( + model_name="elections2021homepage", + name="carousel", + field=wagtail.core.fields.StreamField( + [ + ( + "slide", + wagtail.core.blocks.StructBlock( + [ + ( + "title", + wagtail.core.blocks.CharBlock(label="titulek"), + ), + ( + "photo", + wagtail.images.blocks.ImageChooserBlock( + label="fotka" + ), + ), + ( + "button_label", + wagtail.core.blocks.CharBlock( + label="text tlačítka" + ), + ), + ( + "page", + wagtail.core.blocks.PageChooserBlock( + label="stránka do tlačítka", + page_type=[ + "elections2021.Elections2021ArticlesPage", + "elections2021.Elections2021CandidatesListPage", + "elections2021.Elections2021CandidatesMapPage", + "elections2021.Elections2021ProgramPage", + "elections2021.Elections2021QuestionsPage", + "elections2021.Elections2021ProgramAppPage", + "elections2021.Elections2021TextPage", + "elections2021.Elections2021StrategicListPage", + "elections2021.Elections2021StrategicPage", + "elections2021.Elections2021MythsPage", + "elections2021.Elections2021DownloadsPage", + "elections2021.Elections2021GovernmentTeamPage", + ], + required=False, + ), + ), + ( + "raw_url", + wagtail.core.blocks.CharBlock( + label="ručně zadaný odkaz do tlačítka (místo stránky)", + required=False, + ), + ), + ] + ), + ) + ], + blank=True, + verbose_name="obsah slideru", + ), + ), + migrations.AlterField( + model_name="elections2021homepage", + name="footer_menu", + field=wagtail.core.fields.StreamField( + [ + ( + "item", + wagtail.core.blocks.StructBlock( + [ + ("name", wagtail.core.blocks.CharBlock(label="název")), + ( + "page", + wagtail.core.blocks.PageChooserBlock( + label="stránka", + page_type=[ + "elections2021.Elections2021ArticlesPage", + "elections2021.Elections2021CandidatesListPage", + "elections2021.Elections2021CandidatesMapPage", + "elections2021.Elections2021ProgramPage", + "elections2021.Elections2021QuestionsPage", + "elections2021.Elections2021ProgramAppPage", + "elections2021.Elections2021TextPage", + "elections2021.Elections2021StrategicListPage", + "elections2021.Elections2021StrategicPage", + "elections2021.Elections2021MythsPage", + "elections2021.Elections2021DownloadsPage", + "elections2021.Elections2021GovernmentTeamPage", + ], + ), + ), + ] + ), + ) + ], + blank=True, + verbose_name="menu projděte si v zápatí", + ), + ), + ] diff --git a/elections2021/static/elections2021/pdf/style.css b/elections2021/static/elections2021/pdf/style.css index 92d180f797136c6342d4b1b47d435515cb8fa84c..f5988b8771470500737e2c9b0ed99ecea2548169 100644 --- a/elections2021/static/elections2021/pdf/style.css +++ b/elections2021/static/elections2021/pdf/style.css @@ -34,14 +34,12 @@ background-repeat: no-repeat; background-position: center; width: 100%; - content: string(chapter); height: 5.5mm; text-align: left; padding: 2.2mm 3mm 1.8mm; box-sizing: border-box; - font-family: 'Bebas Neue', Helvetica, Arial, sans-serif; - font-size: 9pt; - letter-spacing: 0.2pt; + font-family: 'Roboto', Arial, sans-serif; + font-size: 8pt; } @bottom-right{ width: 100%; @@ -69,7 +67,7 @@ table,tr{ } #chaptertitle{ - string-set: chapter content(); + string-set: chapter "fujaja" content(); font-size: 16.5mm; line-height: 1.1; }