OpenSlides/openslides/assignments/config_variables.py

80 lines
2.3 KiB
Python
Raw Normal View History

2019-10-29 09:44:19 +01:00
from openslides.assignments.models import AssignmentPoll
2015-06-29 12:08:15 +02:00
from openslides.core.config import ConfigVariable
def get_config_variables():
"""
Generator which yields all config variables of this app.
They are grouped in 'Ballot and ballot papers' and 'PDF'. The generator has
to be evaluated during app loading (see apps.py).
"""
# Voting
yield ConfigVariable(
2019-10-29 09:44:19 +01:00
name="assignment_poll_default_100_percent_base",
default_value="YNA",
2019-01-06 16:22:33 +01:00
input_type="choice",
label="The 100-%-base of an election result consists of",
2019-10-29 09:44:19 +01:00
choices=tuple(
{"value": base[0], "display_name": base[1]}
for base in AssignmentPoll.PERCENT_BASES
2019-01-06 16:22:33 +01:00
),
2019-10-29 09:44:19 +01:00
weight=400,
group="Voting",
2019-10-29 09:44:19 +01:00
subgroup="Elections",
2019-01-06 16:22:33 +01:00
)
yield ConfigVariable(
2019-10-29 09:44:19 +01:00
name="assignment_poll_default_majority_method",
default_value="simple",
2019-01-06 16:22:33 +01:00
input_type="choice",
2019-10-29 09:44:19 +01:00
choices=tuple(
{"value": method[0], "display_name": method[1]}
for method in AssignmentPoll.MAJORITY_METHODS
),
2019-01-06 16:22:33 +01:00
label="Required majority",
help_text="Default method to check whether a candidate has reached the required majority.",
2019-10-29 09:44:19 +01:00
weight=405,
hidden=True,
group="Voting",
2019-10-29 09:44:19 +01:00
subgroup="Elections",
2019-01-06 16:22:33 +01:00
)
yield ConfigVariable(
2019-10-29 09:44:19 +01:00
name="assignment_poll_add_candidates_to_list_of_speakers",
default_value=True,
input_type="boolean",
label="Put all candidates on the list of speakers",
2019-10-29 09:44:19 +01:00
weight=410,
group="Voting",
2019-10-29 09:44:19 +01:00
subgroup="Elections",
)
2020-01-30 16:59:46 +01:00
yield ConfigVariable(
name="assignment_poll_default_groups",
default_value=[],
input_type="groups",
label="Default groups for named and pseudoanonymous assignment polls",
weight=415,
group="Voting",
subgroup="Elections",
)
# PDF
yield ConfigVariable(
2019-01-06 16:22:33 +01:00
name="assignments_pdf_title",
default_value="Elections",
label="Title for PDF document (all elections)",
weight=460,
2019-01-06 16:22:33 +01:00
group="Elections",
subgroup="PDF export",
2019-01-06 16:22:33 +01:00
)
yield ConfigVariable(
2019-01-06 16:22:33 +01:00
name="assignments_pdf_preamble",
default_value="",
label="Preamble text for PDF document (all elections)",
weight=470,
2019-01-06 16:22:33 +01:00
group="Elections",
subgroup="PDF export",
2019-01-06 16:22:33 +01:00
)