2016-10-15 18:16:22 +02:00
|
|
|
from django.core.validators import MinValueValidator
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
from openslides.core.config import ConfigVariable
|
|
|
|
|
|
|
|
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-09-03 21:43:11 +02:00
|
|
|
|
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-12-12 14:21:22 +01:00
|
|
|
default_value='The assembly may decide:',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='Motion preamble',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=320,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
2017-08-22 14:17:20 +02:00
|
|
|
subgroup='General')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
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'},
|
2016-11-01 23:30:54 +01:00
|
|
|
{'value': 'none', 'display_name': 'Disabled'}),
|
2016-08-20 10:07:56 +02:00
|
|
|
weight=322,
|
|
|
|
group='Motions',
|
|
|
|
subgroup='General')
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_line_length',
|
2017-02-17 09:48:19 +01:00
|
|
|
default_value=90,
|
2016-08-20 10:07:56 +02:00
|
|
|
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
|
|
|
|
2016-09-03 21:43:11 +02:00
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_recommendations_by',
|
2016-09-30 17:19:27 +02:00
|
|
|
default_value='',
|
2016-11-30 22:58:47 +01:00
|
|
|
label='Name of recommender',
|
|
|
|
help_text='Will be displayed as label before selected recommendation. Use an empty value to disable the recommendation system.',
|
2016-09-03 21:43:11 +02:00
|
|
|
weight=332,
|
|
|
|
group='Motions',
|
2017-08-22 14:17:20 +02:00
|
|
|
subgroup='General')
|
2016-09-03 21:43:11 +02:00
|
|
|
|
2017-02-17 15:05:51 +01:00
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_recommendation_text_mode',
|
|
|
|
default_value='original',
|
|
|
|
input_type='choice',
|
|
|
|
label='Default text version for change recommendations',
|
|
|
|
choices=(
|
|
|
|
{'value': 'original', 'display_name': 'Original version'},
|
|
|
|
{'value': 'changed', 'display_name': 'Changed version'},
|
|
|
|
{'value': 'diff', 'display_name': 'Diff version'},
|
|
|
|
{'value': 'agreed', 'display_name': 'Final version'}),
|
|
|
|
weight=333,
|
|
|
|
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-08-31 12:05:33 +02:00
|
|
|
default_value='-',
|
2016-06-09 16:12:13 +02:00
|
|
|
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(
|
2016-12-02 00:12:37 +01:00
|
|
|
name='motions_amendments_apply_text',
|
2016-08-19 21:03:14 +02:00
|
|
|
default_value=False,
|
|
|
|
input_type='boolean',
|
2016-12-02 00:12:37 +01:00
|
|
|
label='Apply text for new amendments',
|
|
|
|
help_text='The title of the motion is always applied.',
|
2016-08-19 21:03:14 +02:00
|
|
|
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
|
|
|
|
2016-07-29 23:33:47 +02:00
|
|
|
# Comments
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_comments',
|
2016-09-30 17:19:27 +02:00
|
|
|
default_value=[],
|
2016-09-09 15:16:56 +02:00
|
|
|
input_type='comments',
|
2016-07-29 23:33:47 +02:00
|
|
|
label='Comment fields for motions',
|
|
|
|
weight=353,
|
|
|
|
group='Motions',
|
|
|
|
subgroup='Comments')
|
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
# Voting and ballot papers
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_poll_100_percent_base',
|
2016-08-26 13:46:57 +02:00
|
|
|
default_value='YES_NO_ABSTAIN',
|
2016-06-02 12:47:01 +02:00
|
|
|
input_type='choice',
|
2016-06-09 16:12:13 +02:00
|
|
|
label='The 100 % base of a voting result consists of',
|
2016-08-26 13:46:57 +02:00
|
|
|
choices=(
|
|
|
|
{'value': 'YES_NO_ABSTAIN', 'display_name': 'Yes/No/Abstain'},
|
|
|
|
{'value': 'YES_NO', 'display_name': 'Yes/No'},
|
|
|
|
{'value': 'VALID', 'display_name': 'All valid ballots'},
|
|
|
|
{'value': 'CAST', 'display_name': 'All casted ballots'},
|
|
|
|
{'value': 'DISABLED', 'display_name': 'Disabled (no percents)'}
|
|
|
|
),
|
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
|
|
|
|
2016-10-15 18:16:22 +02:00
|
|
|
# TODO: Add server side validation of the choices.
|
2016-10-12 17:28:18 +02:00
|
|
|
yield ConfigVariable(
|
2016-10-15 18:16:22 +02:00
|
|
|
name='motions_poll_default_majority_method',
|
|
|
|
default_value='simple_majority',
|
|
|
|
input_type='majorityMethod',
|
2016-10-17 16:30:03 +02:00
|
|
|
label='Required majority',
|
|
|
|
help_text='Default method to check whether a motion has reached the required majority.',
|
2016-10-12 17:28:18 +02:00
|
|
|
weight=357,
|
|
|
|
group='Motions',
|
2016-10-15 18:16:22 +02:00
|
|
|
subgroup='Voting and ballot papers')
|
2016-10-12 17:28:18 +02:00
|
|
|
|
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),))
|
|
|
|
|
2016-09-13 11:54:30 +02:00
|
|
|
# PDF and DOCX export
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2016-09-13 11:54:30 +02:00
|
|
|
name='motions_export_title',
|
2016-06-09 16:12:13 +02:00
|
|
|
default_value='Motions',
|
2016-09-13 11:54:30 +02:00
|
|
|
label='Title for PDF and DOCX documents (all motions)',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=370,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
2017-08-22 14:17:20 +02:00
|
|
|
subgroup='Export')
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2016-09-13 11:54:30 +02:00
|
|
|
name='motions_export_preamble',
|
2016-06-02 12:47:01 +02:00
|
|
|
default_value='',
|
2016-09-13 11:54:30 +02:00
|
|
|
label='Preamble text for PDF and DOCX documents (all motions)',
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=375,
|
2016-06-09 16:12:13 +02:00
|
|
|
group='Motions',
|
2016-09-13 11:54:30 +02:00
|
|
|
subgroup='Export')
|
2017-07-26 15:21:49 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_export_category_sorting',
|
|
|
|
default_value='prefix',
|
|
|
|
input_type='choice',
|
|
|
|
label='Sort categories by',
|
|
|
|
choices=(
|
|
|
|
{'value': 'prefix', 'display_name': 'Prefix'},
|
|
|
|
{'value': 'name', 'display_name': 'Name'}),
|
2017-07-26 15:34:05 +02:00
|
|
|
weight=380,
|
2017-07-26 15:21:49 +02:00
|
|
|
group='Motions',
|
|
|
|
subgroup='Export')
|
2017-07-26 14:50:10 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name='motions_export_sequential_number',
|
|
|
|
default_value=True,
|
|
|
|
input_type='boolean',
|
|
|
|
label='Include the sequential number in PDF and DOCX',
|
|
|
|
weight=385,
|
|
|
|
group='Motions',
|
|
|
|
subgroup='Export')
|