2015-06-17 18:32:05 +02:00
|
|
|
from django.core.validators import MinValueValidator
|
2013-03-01 17:13:12 +01:00
|
|
|
|
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
|
|
|
"""
|
2014-01-31 00:55:18 +01:00
|
|
|
# Ballot and ballot papers
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='assignments_poll_vote_values',
|
2014-01-31 00:55:18 +01:00
|
|
|
default_value='auto',
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='choice',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Election method',
|
2015-06-17 18:32:05 +02:00
|
|
|
choices=(
|
2016-06-09 16:12:13 +02:00
|
|
|
{'value': 'auto', 'display_name': 'Automatic assign of method'},
|
|
|
|
{'value': 'votes', 'display_name': 'Always one option per candidate'},
|
|
|
|
{'value': 'yesnoabstain', 'display_name': 'Always Yes-No-Abstain per candidate'},
|
|
|
|
{'value': 'yesno', 'display_name': 'Always Yes/No per candidate'}),
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=410,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Elections',
|
|
|
|
subgroup='Ballot and ballot papers')
|
2015-06-17 18:32:05 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='assignments_poll_100_percent_base',
|
2016-08-26 13:46:57 +02:00
|
|
|
default_value='YES_NO_ABSTAIN',
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='choice',
|
2016-11-04 12:02:16 +01:00
|
|
|
label='The 100-%-base of an election result consists of',
|
2016-08-26 13:46:57 +02:00
|
|
|
choices=(
|
|
|
|
{'value': 'YES_NO_ABSTAIN', 'display_name': 'Yes/No/Abstain per candidate'},
|
|
|
|
{'value': 'YES_NO', 'display_name': 'Yes/No per candidate'},
|
|
|
|
{'value': 'VALID', 'display_name': 'All valid ballots'},
|
|
|
|
{'value': 'CAST', 'display_name': 'All casted ballots'},
|
|
|
|
{'value': 'DISABLED', 'display_name': 'Disabled (no percents)'}),
|
2016-11-04 12:02:16 +01:00
|
|
|
help_text=('For Yes/No/Abstain per candidate and Yes/No per candidate the 100-%-base '
|
|
|
|
'depends on the election method: If there is only one option per candidate, '
|
|
|
|
'the sum of all votes of all candidates is 100 %. Otherwise for each '
|
|
|
|
'candidate the sum of all votes is 100 %.'),
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=420,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Elections',
|
|
|
|
subgroup='Ballot and ballot papers')
|
2015-06-17 18:32:05 +02:00
|
|
|
|
2016-10-26 18:32:00 +02:00
|
|
|
# TODO: Add server side validation of the choices.
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='assignments_poll_default_majority_method',
|
|
|
|
default_value='simple_majority',
|
|
|
|
input_type='majorityMethod',
|
|
|
|
label='Required majority',
|
|
|
|
help_text='Default method to check whether a candidate has reached the required majority.',
|
|
|
|
weight=425,
|
|
|
|
group='Elections',
|
|
|
|
subgroup='Ballot and ballot papers')
|
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='assignments_pdf_ballot_papers_selection',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='CUSTOM_NUMBER',
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='choice',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Number of ballot papers (selection)',
|
2015-06-17 18:32:05 +02:00
|
|
|
choices=(
|
2016-06-09 16:12:13 +02:00
|
|
|
{'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'}),
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=430,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Elections',
|
|
|
|
subgroup='Ballot and ballot papers')
|
2015-06-17 18:32:05 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='assignments_pdf_ballot_papers_number',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value=8,
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='integer',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Custom number of ballot papers',
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=440,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Elections',
|
|
|
|
subgroup='Ballot and ballot papers',
|
2015-06-17 18:32:05 +02:00
|
|
|
validators=(MinValueValidator(1),))
|
|
|
|
|
2014-01-31 00:55:18 +01:00
|
|
|
# PDF
|
2015-06-17 18:32:05 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='assignments_pdf_title',
|
2016-06-09 16:12:13 +02:00
|
|
|
default_value='Elections',
|
|
|
|
label='Title for PDF document (all elections)',
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=460,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Elections',
|
2017-08-22 14:17:20 +02:00
|
|
|
subgroup='PDF')
|
2015-06-17 18:32:05 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='assignments_pdf_preamble',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Preamble text for PDF document (all elections)',
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=470,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Elections',
|
|
|
|
subgroup='PDF')
|