Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
6d19844e
Commit
6d19844e
authored
3 years ago
by
jan.bednarik
Browse files
Options
Downloads
Patches
Plain Diff
elections2021: Exports by ministry
parent
07175eda
No related branches found
No related tags found
2 merge requests
!326
elections2021: Exports by ministry
,
!325
elections2021: Exports by ministry
Pipeline
#4609
passed
3 years ago
Stage: build
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
elections2021/management/commands/export_program.py
+11
-7
11 additions, 7 deletions
elections2021/management/commands/export_program.py
with
11 additions
and
7 deletions
elections2021/management/commands/export_program.py
+
11
−
7
View file @
6d19844e
...
@@ -86,15 +86,18 @@ def plain_export(output_file, output_format):
...
@@ -86,15 +86,18 @@ def plain_export(output_file, output_format):
file
.
write
(
content
)
file
.
write
(
content
)
def
fancy_export
(
output_file
):
def
fancy_export
(
output_file
,
ministry
=
None
):
tmp_file
=
f
"
{
output_file
}
.tmp
"
tmp_file
=
f
"
{
output_file
}
.tmp
"
benefits_titles
=
dict
(
BENEFITS_CHOICES
)
benefits_titles
=
dict
(
BENEFITS_CHOICES
)
pages
=
(
if
ministry
is
None
:
Elections2021ProgramPointPage
.
objects
.
live
()
pages
=
(
.
specific
()
Elections2021ProgramPointPage
.
objects
.
live
()
.
order_by
(
"
-default_order
"
)
.
specific
()
)
.
order_by
(
"
-default_order
"
)
)
else
:
pages
=
get_ministry_points
(
ministry
)
points
=
[]
points
=
[]
for
page
in
pages
:
for
page
in
pages
:
...
@@ -133,6 +136,7 @@ class Command(BaseCommand):
...
@@ -133,6 +136,7 @@ class Command(BaseCommand):
def
add_arguments
(
self
,
parser
):
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
"
output
"
,
type
=
str
,
help
=
"
.pdf nebo .html soubor
"
)
parser
.
add_argument
(
"
output
"
,
type
=
str
,
help
=
"
.pdf nebo .html soubor
"
)
parser
.
add_argument
(
"
--fancy
"
,
action
=
"
store_true
"
)
parser
.
add_argument
(
"
--fancy
"
,
action
=
"
store_true
"
)
parser
.
add_argument
(
"
--ministry
"
,
type
=
str
)
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
output_file
=
options
[
"
output
"
]
output_file
=
options
[
"
output
"
]
...
@@ -147,6 +151,6 @@ class Command(BaseCommand):
...
@@ -147,6 +151,6 @@ class Command(BaseCommand):
if
options
[
"
fancy
"
]:
if
options
[
"
fancy
"
]:
if
output_format
!=
FORMAT_PDF
:
if
output_format
!=
FORMAT_PDF
:
raise
CommandError
(
"
Fancy export lze udělat jen do .pdf
"
)
raise
CommandError
(
"
Fancy export lze udělat jen do .pdf
"
)
fancy_export
(
output_file
)
fancy_export
(
output_file
,
options
[
"
ministry
"
]
)
else
:
else
:
plain_export
(
output_file
,
output_format
)
plain_export
(
output_file
,
output_format
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment