2013-03-01 17:13:12 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from django import forms
|
2013-09-25 10:01:01 +02:00
|
|
|
from django.dispatch import receiver
|
|
|
|
from django.utils.translation import ugettext as _
|
|
|
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2013-12-02 19:33:43 +01:00
|
|
|
from openslides.config.api import ConfigCollection, ConfigVariable
|
2013-03-01 17:13:12 +01:00
|
|
|
from openslides.config.signals import config_signal
|
|
|
|
|
|
|
|
|
2013-12-02 19:33:43 +01:00
|
|
|
@receiver(config_signal, dispatch_uid='setup_assignment_config')
|
|
|
|
def setup_assignment_config(sender, **kwargs):
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
|
|
|
Assignment config variables.
|
|
|
|
"""
|
|
|
|
assignment_publish_winner_results_only = ConfigVariable(
|
|
|
|
name='assignment_publish_winner_results_only',
|
|
|
|
default_value=False,
|
|
|
|
form_field=forms.BooleanField(
|
|
|
|
required=False,
|
2013-04-22 19:59:05 +02:00
|
|
|
label=ugettext_lazy('Only publish voting results for selected '
|
|
|
|
'winners (Projector view only)')))
|
2013-03-01 17:13:12 +01:00
|
|
|
assignment_pdf_ballot_papers_selection = ConfigVariable(
|
|
|
|
name='assignment_pdf_ballot_papers_selection',
|
|
|
|
default_value='CUSTOM_NUMBER',
|
|
|
|
form_field=forms.ChoiceField(
|
|
|
|
widget=forms.Select(),
|
|
|
|
required=False,
|
2013-04-22 19:59:05 +02:00
|
|
|
label=ugettext_lazy('Number of ballot papers (selection)'),
|
2013-03-01 17:13:12 +01:00
|
|
|
choices=(
|
2013-04-22 19:59:05 +02:00
|
|
|
('NUMBER_OF_DELEGATES', ugettext_lazy('Number of all delegates')),
|
|
|
|
('NUMBER_OF_ALL_PARTICIPANTS', ugettext_lazy('Number of all participants')),
|
|
|
|
('CUSTOM_NUMBER', ugettext_lazy('Use the following custom number')))))
|
2013-03-01 17:13:12 +01:00
|
|
|
assignment_pdf_ballot_papers_number = ConfigVariable(
|
|
|
|
name='assignment_pdf_ballot_papers_number',
|
|
|
|
default_value=8,
|
|
|
|
form_field=forms.IntegerField(
|
|
|
|
widget=forms.TextInput(attrs={'class': 'small-input'}),
|
|
|
|
required=False,
|
|
|
|
min_value=1,
|
2013-04-22 19:59:05 +02:00
|
|
|
label=ugettext_lazy('Custom number of ballot papers')))
|
2013-03-01 17:13:12 +01:00
|
|
|
assignment_pdf_title = ConfigVariable(
|
|
|
|
name='assignment_pdf_title',
|
|
|
|
default_value=_('Elections'),
|
2014-01-31 01:54:41 +01:00
|
|
|
translatable=True,
|
2013-03-01 17:13:12 +01:00
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
required=False,
|
2013-04-22 19:59:05 +02:00
|
|
|
label=ugettext_lazy('Title for PDF document (all elections)')))
|
2013-03-01 17:13:12 +01:00
|
|
|
assignment_pdf_preamble = ConfigVariable(
|
|
|
|
name='assignment_pdf_preamble',
|
|
|
|
default_value='',
|
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.Textarea(),
|
|
|
|
required=False,
|
2013-04-22 19:59:05 +02:00
|
|
|
label=ugettext_lazy('Preamble text for PDF document (all elections)')))
|
2013-03-01 17:13:12 +01:00
|
|
|
assignment_poll_vote_values = ConfigVariable(
|
|
|
|
name='assignment_poll_vote_values',
|
|
|
|
default_value='auto',
|
|
|
|
form_field=forms.ChoiceField(
|
|
|
|
widget=forms.Select(),
|
|
|
|
required=False,
|
2013-04-22 19:59:05 +02:00
|
|
|
label=ugettext_lazy('Election method'),
|
2013-03-01 17:13:12 +01:00
|
|
|
choices=(
|
2013-04-22 19:59:05 +02:00
|
|
|
('auto', ugettext_lazy('Automatic assign of method')),
|
|
|
|
('votes', ugettext_lazy('Always one option per candidate')),
|
|
|
|
('yesnoabstain', ugettext_lazy('Always Yes-No-Abstain per candidate')))))
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2013-12-02 19:33:43 +01:00
|
|
|
return ConfigCollection(title=ugettext_noop('Elections'),
|
|
|
|
url='assignment',
|
|
|
|
required_permission='config.can_manage',
|
|
|
|
weight=40,
|
|
|
|
variables=(assignment_publish_winner_results_only,
|
|
|
|
assignment_pdf_ballot_papers_selection,
|
|
|
|
assignment_pdf_ballot_papers_number,
|
|
|
|
assignment_pdf_title,
|
|
|
|
assignment_pdf_preamble,
|
|
|
|
assignment_poll_vote_values))
|