2016-06-02 12:47:01 +02:00
|
|
|
from django.core.validators import MinValueValidator
|
|
|
|
|
|
|
|
from openslides.core.config import ConfigVariable
|
|
|
|
from openslides.poll.models import PERCENT_BASE_CHOICES
|
|
|
|
|
|
|
|
from .models import Workflow
|
|
|
|
|
|
|
|
|
|
|
|
def get_workflow_choices():
|
|
|
|
"""
|
|
|
|
Returns a list of all workflows to be used as choices for the config variable
|
|
|
|
'motions_workflow'. Each list item contains the pk and the display name.
|
|
|
|
"""
|
2016-06-09 16:12:13 +02:00
|
|
|
return [{'value': str(workflow.pk), 'display_name': workflow.name}
|
2016-06-02 12:47:01 +02:00
|
|
|
for workflow in Workflow.objects.all()]
|
|
|
|
|
|
|
|
|
|
|
|
def get_config_variables():
|
|
|
|
"""
|
|
|
|
Generator which yields all config variables of this app.
|
|
|
|
|
|
|
|
They are grouped in 'General', 'Amendments', 'Supporters', 'Voting and ballot
|
|
|
|
papers' and 'PDF'. The generator has to be evaluated during app loading
|
|
|
|
(see apps.py).
|
|
|
|
"""
|
2016-08-29 16:08:27 +02:00
|
|
|
PERCENT_BASE_CHOICES_MOTION = ({
|
2016-06-07 16:13:30 +02:00
|
|
|
'value': "WITHOUT_ABSTAIN",
|
2016-08-29 16:08:27 +02:00
|
|
|
'display_name': 'Yes and No votes'},)
|
|
|
|
PERCENT_BASE_CHOICES_MOTION += PERCENT_BASE_CHOICES
|
2016-06-02 12:47:01 +02:00
|
|
|
# General
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_workflow',
|
|
|
|
default_value='1',
|
|
|
|
input_type='choice',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Workflow of new motions',
|
2016-06-02 12:47:01 +02:00
|
|
|
choices=get_workflow_choices,
|
|
|
|
weight=310,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='General')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_identifier',
|
|
|
|
default_value='per_category',
|
|
|
|
input_type='choice',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Identifier',
|
2016-06-02 12:47:01 +02:00
|
|
|
choices=(
|
2016-06-09 16:12:13 +02:00
|
|
|
{'value': 'per_category', 'display_name': 'Numbered per category'},
|
|
|
|
{'value': 'serially_numbered', 'display_name': 'Serially numbered'},
|
|
|
|
{'value': 'manually', 'display_name': 'Set it manually'}),
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=315,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='General')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_preamble',
|
2016-06-09 16:12:13 +02:00
|
|
|
default_value='The assembly may decide,',
|
|
|
|
label='Motion preamble',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=320,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='General',
|
2016-06-02 12:47:01 +02:00
|
|
|
translatable=True)
|
|
|
|
|
2016-08-20 10:07:56 +02:00
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_default_line_numbering',
|
|
|
|
default_value='none',
|
|
|
|
input_type='choice',
|
|
|
|
label='Default line numbering',
|
|
|
|
choices=(
|
|
|
|
{'value': 'outside', 'display_name': 'Outside'},
|
|
|
|
{'value': 'inline', 'display_name': 'Inline'},
|
|
|
|
{'value': 'none', 'display_name': 'None'}),
|
|
|
|
weight=322,
|
|
|
|
group='Motions',
|
|
|
|
subgroup='General')
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_line_length',
|
|
|
|
default_value=80,
|
|
|
|
input_type='integer',
|
|
|
|
label='Line length',
|
|
|
|
help_text='The maximum number of characters per line. Relevant when line numbering is enabled. Min: 40',
|
|
|
|
weight=323,
|
|
|
|
group='Motions',
|
|
|
|
subgroup='General',
|
|
|
|
validators=(MinValueValidator(40),))
|
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_stop_submitting',
|
|
|
|
default_value=False,
|
|
|
|
input_type='boolean',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Stop submitting new motions by non-staff users',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=325,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='General')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_allow_disable_versioning',
|
|
|
|
default_value=False,
|
|
|
|
input_type='boolean',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Allow to disable versioning',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=330,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='General')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
# Amendments
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_amendments_enabled',
|
|
|
|
default_value=False,
|
|
|
|
input_type='boolean',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Activate amendments',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=335,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='Amendments')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_amendments_prefix',
|
2016-06-09 16:12:13 +02:00
|
|
|
default_value='A',
|
|
|
|
label='Prefix for the identifier for amendments',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=340,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='Amendments')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
2016-08-19 21:03:14 +02:00
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_amendments_apply_title_text',
|
|
|
|
default_value=False,
|
|
|
|
input_type='boolean',
|
|
|
|
label='Apply title and text for new amendments',
|
|
|
|
weight=342,
|
|
|
|
group='Motions',
|
|
|
|
subgroup='Amendments')
|
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
# Supporters
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_min_supporters',
|
|
|
|
default_value=0,
|
|
|
|
input_type='integer',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Number of (minimum) required supporters for a motion',
|
|
|
|
help_text='Choose 0 to disable the supporting system.',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=345,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='Supporters',
|
2016-06-02 12:47:01 +02:00
|
|
|
validators=(MinValueValidator(0),))
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_remove_supporters',
|
|
|
|
default_value=False,
|
|
|
|
input_type='boolean',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Remove all supporters of a motion if a submitter edits his motion in early state',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=350,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='Supporters')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
# Voting and ballot papers
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_poll_100_percent_base',
|
|
|
|
default_value='WITHOUT_INVALID',
|
|
|
|
input_type='choice',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='The 100 % base of a voting result consists of',
|
2016-08-29 16:08:27 +02:00
|
|
|
choices=PERCENT_BASE_CHOICES_MOTION,
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=355,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='Voting and ballot papers')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_pdf_ballot_papers_selection',
|
|
|
|
default_value='CUSTOM_NUMBER',
|
|
|
|
input_type='choice',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Number of ballot papers (selection)',
|
2016-06-02 12:47:01 +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'}),
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=360,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='Voting and ballot papers')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_pdf_ballot_papers_number',
|
|
|
|
default_value=8,
|
|
|
|
input_type='integer',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Custom number of ballot papers',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=365,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='Voting and ballot papers',
|
2016-06-02 12:47:01 +02:00
|
|
|
validators=(MinValueValidator(1),))
|
|
|
|
|
|
|
|
# PDF
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_pdf_title',
|
2016-06-09 16:12:13 +02:00
|
|
|
default_value='Motions',
|
|
|
|
label='Title for PDF document (all motions)',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=370,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='PDF',
|
2016-06-02 12:47:01 +02:00
|
|
|
translatable=True)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_pdf_preamble',
|
|
|
|
default_value='',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Preamble text for PDF document (all motions)',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=375,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='PDF')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_pdf_paragraph_numbering',
|
|
|
|
default_value=False,
|
|
|
|
input_type='boolean',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Show paragraph numbering (only in PDF)',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=380,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='PDF')
|