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
|
2014-04-10 20:18:22 +02:00
|
|
|
from openslides.poll.models import PERCENT_BASE_CHOICES
|
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',
|
2014-04-10 20:18:22 +02:00
|
|
|
default_value='WITHOUT_INVALID',
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='choice',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='The 100 % base of an election result consists of',
|
2015-06-17 18:32:05 +02:00
|
|
|
choices=PERCENT_BASE_CHOICES,
|
|
|
|
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
|
|
|
|
|
|
|
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',
|
|
|
|
subgroup='PDF',
|
2015-06-17 18:32:05 +02:00
|
|
|
translatable=True)
|
|
|
|
|
|
|
|
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')
|