Skip to content
Snippets Groups Projects
Commit 6d19844e authored by jan.bednarik's avatar jan.bednarik
Browse files

elections2021: Exports by ministry

parent 07175eda
Branches
No related tags found
2 merge requests!326elections2021: Exports by ministry,!325elections2021: Exports by ministry
Pipeline #4609 passed
......@@ -86,15 +86,18 @@ def plain_export(output_file, output_format):
file.write(content)
def fancy_export(output_file):
def fancy_export(output_file, ministry=None):
tmp_file = f"{output_file}.tmp"
benefits_titles = dict(BENEFITS_CHOICES)
if ministry is None:
pages = (
Elections2021ProgramPointPage.objects.live()
.specific()
.order_by("-default_order")
)
else:
pages = get_ministry_points(ministry)
points = []
for page in pages:
......@@ -133,6 +136,7 @@ class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("output", type=str, help=".pdf nebo .html soubor")
parser.add_argument("--fancy", action="store_true")
parser.add_argument("--ministry", type=str)
def handle(self, *args, **options):
output_file = options["output"]
......@@ -147,6 +151,6 @@ class Command(BaseCommand):
if options["fancy"]:
if output_format != FORMAT_PDF:
raise CommandError("Fancy export lze udělat jen do .pdf")
fancy_export(output_file)
fancy_export(output_file, options["ministry"])
else:
plain_export(output_file, output_format)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment