2020-02-04 16:25:42 +01:00
|
|
|
from django.core.validators import MinValueValidator
|
|
|
|
|
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
|
2013-03-01 17:13:12 +01:00
|
|
|
|
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
def get_config_variables():
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
2016-06-02 12:47:01 +02:00
|
|
|
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).
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
2020-01-22 17:39:10 +01:00
|
|
|
# Voting
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2020-02-25 10:54:29 +01:00
|
|
|
name="assignment_poll_method",
|
|
|
|
default_value="votes",
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="choice",
|
2020-03-15 23:56:49 +01:00
|
|
|
label="Default election method",
|
2019-10-29 09:44:19 +01:00
|
|
|
choices=tuple(
|
2020-02-25 10:54:29 +01:00
|
|
|
{"value": method[0], "display_name": method[1]}
|
|
|
|
for method in AssignmentPoll.POLLMETHODS
|
2019-01-06 16:22:33 +01:00
|
|
|
),
|
2019-10-29 09:44:19 +01:00
|
|
|
weight=400,
|
2020-02-04 16:25:42 +01:00
|
|
|
group="Elections",
|
2020-02-25 10:54:29 +01:00
|
|
|
subgroup="Ballot",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|
2015-06-17 18:32:05 +02:00
|
|
|
|
2016-10-26 18:32:00 +02:00
|
|
|
yield ConfigVariable(
|
2020-02-25 10:54:29 +01:00
|
|
|
name="assignment_poll_default_100_percent_base",
|
2020-03-06 13:21:16 +01:00
|
|
|
default_value="valid",
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="choice",
|
2020-03-15 23:56:49 +01:00
|
|
|
label="Default 100 % base of an election result",
|
2019-10-29 09:44:19 +01:00
|
|
|
choices=tuple(
|
2020-02-25 10:54:29 +01:00
|
|
|
{"value": base[0], "display_name": base[1]}
|
|
|
|
for base in AssignmentPoll.PERCENT_BASES
|
2019-10-29 09:44:19 +01:00
|
|
|
),
|
|
|
|
weight=405,
|
2020-02-04 16:25:42 +01:00
|
|
|
group="Elections",
|
2020-02-25 10:54:29 +01:00
|
|
|
subgroup="Ballot",
|
2020-02-04 16:25:42 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name="assignment_poll_default_groups",
|
|
|
|
default_value=[],
|
|
|
|
input_type="groups",
|
2020-02-25 10:54:29 +01:00
|
|
|
label="Default groups with voting rights",
|
2020-02-04 16:25:42 +01:00
|
|
|
weight=410,
|
|
|
|
group="Elections",
|
2020-02-25 10:54:29 +01:00
|
|
|
subgroup="Ballot",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|
2016-10-26 18:32:00 +02:00
|
|
|
|
2020-02-24 16:55:07 +01:00
|
|
|
yield ConfigVariable(
|
2020-02-25 10:54:29 +01:00
|
|
|
name="assignment_poll_default_majority_method",
|
|
|
|
default_value="simple",
|
2020-02-24 16:55:07 +01:00
|
|
|
input_type="choice",
|
|
|
|
choices=tuple(
|
|
|
|
{"value": method[0], "display_name": method[1]}
|
2020-02-25 10:54:29 +01:00
|
|
|
for method in AssignmentPoll.MAJORITY_METHODS
|
2020-02-24 16:55:07 +01:00
|
|
|
),
|
2020-02-25 10:54:29 +01:00
|
|
|
label="Required majority",
|
|
|
|
help_text="Default method to check whether a candidate has reached the required majority.",
|
2020-02-24 16:55:07 +01:00
|
|
|
weight=415,
|
2020-02-25 10:54:29 +01:00
|
|
|
hidden=True,
|
2020-02-24 16:55:07 +01:00
|
|
|
group="Elections",
|
2020-02-25 10:54:29 +01:00
|
|
|
subgroup="Ballot",
|
2020-02-24 16:55:07 +01:00
|
|
|
)
|
|
|
|
|
2020-03-13 16:11:28 +01:00
|
|
|
yield ConfigVariable(
|
|
|
|
name="assignment_poll_sort_poll_result_by_votes",
|
|
|
|
default_value=True,
|
|
|
|
input_type="boolean",
|
|
|
|
label="Sort election results by amount of votes",
|
|
|
|
weight=420,
|
|
|
|
group="Elections",
|
|
|
|
subgroup="Ballot",
|
|
|
|
)
|
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2019-10-29 09:44:19 +01:00
|
|
|
name="assignment_poll_add_candidates_to_list_of_speakers",
|
2019-08-14 21:53:42 +02:00
|
|
|
default_value=True,
|
|
|
|
input_type="boolean",
|
|
|
|
label="Put all candidates on the list of speakers",
|
2020-03-13 16:11:28 +01:00
|
|
|
weight=425,
|
2020-02-04 16:25:42 +01:00
|
|
|
group="Elections",
|
2020-02-25 10:54:29 +01:00
|
|
|
subgroup="Ballot",
|
2019-08-14 21:53:42 +02:00
|
|
|
)
|
|
|
|
|
2020-02-04 16:25:42 +01:00
|
|
|
# Ballot Paper
|
2020-01-30 16:59:46 +01:00
|
|
|
yield ConfigVariable(
|
2020-02-04 16:25:42 +01:00
|
|
|
name="assignments_pdf_ballot_papers_selection",
|
|
|
|
default_value="CUSTOM_NUMBER",
|
|
|
|
input_type="choice",
|
2020-03-15 23:56:49 +01:00
|
|
|
label="Number of ballot papers",
|
2020-02-04 16:25:42 +01:00
|
|
|
choices=(
|
|
|
|
{"value": "NUMBER_OF_DELEGATES", "display_name": "Number of all delegates"},
|
|
|
|
{
|
|
|
|
"value": "NUMBER_OF_ALL_PARTICIPANTS",
|
|
|
|
"display_name": "Number of all participants",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value": "CUSTOM_NUMBER",
|
|
|
|
"display_name": "Use the following custom number",
|
|
|
|
},
|
|
|
|
),
|
|
|
|
weight=430,
|
|
|
|
group="Elections",
|
|
|
|
subgroup="Ballot papers",
|
|
|
|
)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name="assignments_pdf_ballot_papers_number",
|
|
|
|
default_value=8,
|
|
|
|
input_type="integer",
|
|
|
|
label="Custom number of ballot papers",
|
|
|
|
weight=435,
|
|
|
|
group="Elections",
|
|
|
|
subgroup="Ballot papers",
|
|
|
|
validators=(MinValueValidator(1),),
|
2020-01-30 16:59:46 +01:00
|
|
|
)
|
|
|
|
|
2014-01-31 00:55:18 +01:00
|
|
|
# PDF
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="assignments_pdf_title",
|
|
|
|
default_value="Elections",
|
|
|
|
label="Title for PDF document (all elections)",
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=460,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Elections",
|
2019-08-14 21:53:42 +02:00
|
|
|
subgroup="PDF export",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|
2015-06-17 18:32:05 +02: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)",
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=470,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Elections",
|
2019-08-14 21:53:42 +02:00
|
|
|
subgroup="PDF export",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|