2015-06-17 18:32:05 +02:00
|
|
|
from django.core.validators import MinValueValidator
|
2013-09-25 10:01:01 +02:00
|
|
|
from django.utils.translation import ugettext as _
|
2015-06-17 18:32:05 +02:00
|
|
|
from django.utils.translation import ugettext_lazy
|
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
|
|
|
|
|
|
|
|
2013-12-02 19:33:43 +01:00
|
|
|
def setup_assignment_config(sender, **kwargs):
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
2015-06-17 18:32:05 +02:00
|
|
|
Receiver function to setup all assignment config variables. They are
|
|
|
|
grouped in 'Ballot and ballot papers' and 'PDF'. This function is
|
2015-06-29 12:08:15 +02:00
|
|
|
connected to the signal openslides.core.signals.config_signal during
|
2014-11-13 22:23:16 +01:00
|
|
|
app loading.
|
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',
|
|
|
|
label=ugettext_lazy('Election method'),
|
|
|
|
choices=(
|
|
|
|
{'value': 'auto', 'display_name': ugettext_lazy('Automatic assign of method')},
|
|
|
|
{'value': 'votes', 'display_name': ugettext_lazy('Always one option per candidate')},
|
|
|
|
{'value': 'yesnoabstain', 'display_name': ugettext_lazy('Always Yes-No-Abstain per candidate')}),
|
|
|
|
weight=410,
|
|
|
|
group=ugettext_lazy('Elections'),
|
|
|
|
subgroup=ugettext_lazy('Ballot and ballot papers'))
|
|
|
|
|
|
|
|
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',
|
|
|
|
label=ugettext_lazy('The 100 % base of an election result consists of'),
|
|
|
|
choices=PERCENT_BASE_CHOICES,
|
|
|
|
weight=420,
|
|
|
|
group=ugettext_lazy('Elections'),
|
|
|
|
subgroup=ugettext_lazy('Ballot and ballot papers'))
|
|
|
|
|
|
|
|
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',
|
|
|
|
label=ugettext_lazy('Number of ballot papers (selection)'),
|
|
|
|
choices=(
|
|
|
|
{'value': 'NUMBER_OF_DELEGATES', 'display_name': ugettext_lazy('Number of all delegates')},
|
|
|
|
{'value': 'NUMBER_OF_ALL_PARTICIPANTS', 'display_name': ugettext_lazy('Number of all participants')},
|
|
|
|
{'value': 'CUSTOM_NUMBER', 'display_name': ugettext_lazy('Use the following custom number')}),
|
|
|
|
weight=430,
|
|
|
|
group=ugettext_lazy('Elections'),
|
|
|
|
subgroup=ugettext_lazy('Ballot and ballot papers'))
|
|
|
|
|
|
|
|
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',
|
|
|
|
label=ugettext_lazy('Custom number of ballot papers'),
|
|
|
|
weight=440,
|
|
|
|
group=ugettext_lazy('Elections'),
|
|
|
|
subgroup=ugettext_lazy('Ballot and ballot papers'),
|
|
|
|
validators=(MinValueValidator(1),))
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='assignments_publish_winner_results_only',
|
2014-01-31 00:55:18 +01:00
|
|
|
default_value=False,
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='boolean',
|
|
|
|
label=ugettext_lazy('Publish election result for elected candidates only '
|
|
|
|
'(projector view)'),
|
|
|
|
weight=450,
|
|
|
|
group=ugettext_lazy('Elections'),
|
|
|
|
subgroup=ugettext_lazy('Ballot and ballot papers'))
|
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',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value=_('Elections'),
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Title for PDF document (all elections)'),
|
|
|
|
weight=460,
|
|
|
|
group=ugettext_lazy('Elections'),
|
|
|
|
subgroup=ugettext_lazy('PDF'),
|
|
|
|
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='',
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Preamble text for PDF document (all elections)'),
|
|
|
|
weight=470,
|
|
|
|
group=ugettext_lazy('Elections'),
|
|
|
|
subgroup=ugettext_lazy('PDF'))
|