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
|
2018-11-22 12:33:40 +01:00
|
|
|
from openslides.poll.majority import majorityMethods
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
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.
|
|
|
|
"""
|
2019-01-06 16:22:33 +01:00
|
|
|
return [
|
|
|
|
{"value": str(workflow.pk), "display_name": workflow.name}
|
|
|
|
for workflow in Workflow.objects.all()
|
|
|
|
]
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
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(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_workflow",
|
|
|
|
default_value="1",
|
|
|
|
input_type="choice",
|
|
|
|
label="Workflow of new motions",
|
2016-06-02 12:47:01 +02:00
|
|
|
choices=get_workflow_choices,
|
|
|
|
weight=310,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
2018-11-22 12:33:40 +01:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_statute_amendments_workflow",
|
|
|
|
default_value="1",
|
|
|
|
input_type="choice",
|
|
|
|
label="Workflow of new statute amendments",
|
2018-11-22 12:33:40 +01:00
|
|
|
choices=get_workflow_choices,
|
|
|
|
weight=312,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2018-11-22 12:33:40 +01:00
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_identifier",
|
|
|
|
default_value="per_category",
|
|
|
|
input_type="choice",
|
|
|
|
label="Identifier",
|
2016-06-02 12:47:01 +02:00
|
|
|
choices=(
|
2019-01-06 16:22:33 +01: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,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_preamble",
|
|
|
|
default_value="The assembly may decide:",
|
|
|
|
label="Motion preamble",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=320,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
2016-08-20 10:07:56 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_default_line_numbering",
|
|
|
|
default_value="none",
|
|
|
|
input_type="choice",
|
|
|
|
label="Default line numbering",
|
2016-08-20 10:07:56 +02:00
|
|
|
choices=(
|
2019-01-06 16:22:33 +01:00
|
|
|
{"value": "outside", "display_name": "outside"},
|
|
|
|
{"value": "inline", "display_name": "inline"},
|
|
|
|
{"value": "none", "display_name": "Disabled"},
|
|
|
|
),
|
2016-08-20 10:07:56 +02:00
|
|
|
weight=322,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2016-08-20 10:07:56 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_line_length",
|
2017-02-17 09:48:19 +01:00
|
|
|
default_value=90,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="integer",
|
|
|
|
label="Line length",
|
|
|
|
help_text="The maximum number of characters per line. Relevant when line numbering is enabled. Min: 40",
|
2016-08-20 10:07:56 +02:00
|
|
|
weight=323,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
validators=(MinValueValidator(40),),
|
|
|
|
)
|
2016-08-20 10:07:56 +02:00
|
|
|
|
2019-01-31 22:33:44 +01:00
|
|
|
yield ConfigVariable(
|
|
|
|
name="motions_reason_required",
|
|
|
|
default_value=False,
|
|
|
|
input_type="boolean",
|
|
|
|
label="Reason required for creating new motion",
|
|
|
|
weight=324,
|
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_disable_reason_on_projector",
|
2016-06-02 12:47:01 +02:00
|
|
|
default_value=False,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="boolean",
|
|
|
|
label="Hide reason on projector",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=325,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
2018-04-10 15:43:21 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_disable_sidebox_on_projector",
|
2018-04-10 15:43:21 +02:00
|
|
|
default_value=False,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="boolean",
|
|
|
|
label="Hide meta information box on projector",
|
2018-04-10 15:43:21 +02:00
|
|
|
weight=326,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2018-04-10 15:43:21 +02:00
|
|
|
|
2017-10-05 10:09:37 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_disable_recommendation_on_projector",
|
2017-10-05 10:09:37 +02:00
|
|
|
default_value=False,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="boolean",
|
|
|
|
label="Hide recommendation on projector",
|
2017-10-05 10:09:37 +02:00
|
|
|
weight=327,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2017-10-05 10:09:37 +02:00
|
|
|
|
2016-09-03 21:43:11 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_recommendations_by",
|
|
|
|
default_value="",
|
|
|
|
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,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2016-09-03 21:43:11 +02:00
|
|
|
|
2018-11-22 12:33:40 +01:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_statute_recommendations_by",
|
|
|
|
default_value="",
|
|
|
|
label="Name of recommender for statute amendments",
|
2019-05-29 09:42:34 +02:00
|
|
|
help_text="Will be displayed as label before selected recommendation in statute amendments.",
|
2018-11-22 12:33:40 +01:00
|
|
|
weight=333,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2018-11-22 12:33:40 +01:00
|
|
|
|
2017-02-17 15:05:51 +01:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_recommendation_text_mode",
|
|
|
|
default_value="original",
|
|
|
|
input_type="choice",
|
|
|
|
label="Default text version for change recommendations",
|
2017-02-17 15:05:51 +01:00
|
|
|
choices=(
|
2019-01-06 16:22:33 +01:00
|
|
|
{"value": "original", "display_name": "Original version"},
|
|
|
|
{"value": "changed", "display_name": "Changed version"},
|
|
|
|
{"value": "diff", "display_name": "Diff version"},
|
|
|
|
{"value": "agreed", "display_name": "Final version"},
|
|
|
|
),
|
2018-11-22 12:33:40 +01:00
|
|
|
weight=334,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
2017-02-17 15:05:51 +01:00
|
|
|
|
2019-02-07 12:34:31 +01:00
|
|
|
yield ConfigVariable(
|
|
|
|
name="motions_category_sorting",
|
|
|
|
default_value="prefix",
|
|
|
|
input_type="choice",
|
|
|
|
label="Sort categories by",
|
|
|
|
choices=(
|
|
|
|
{"value": "prefix", "display_name": "Prefix"},
|
|
|
|
{"value": "name", "display_name": "Name"},
|
|
|
|
),
|
|
|
|
weight=335,
|
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name="motions_motions_sorting",
|
|
|
|
default_value="identifier",
|
|
|
|
input_type="choice",
|
|
|
|
label="Sort motions by",
|
|
|
|
choices=(
|
2019-05-07 16:25:39 +02:00
|
|
|
{"value": "weight", "display_name": "Call list"},
|
2019-02-07 12:34:31 +01:00
|
|
|
{"value": "identifier", "display_name": "Identifier"},
|
|
|
|
),
|
|
|
|
weight=335,
|
|
|
|
group="Motions",
|
|
|
|
subgroup="General",
|
|
|
|
)
|
|
|
|
|
2018-11-30 10:23:09 +01:00
|
|
|
# Amendments
|
2018-10-28 11:06:36 +01:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_statutes_enabled",
|
2018-10-28 11:06:36 +01:00
|
|
|
default_value=False,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="boolean",
|
|
|
|
label="Activate statute amendments",
|
2019-02-07 12:34:31 +01:00
|
|
|
weight=338,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Amendments",
|
|
|
|
)
|
2018-10-28 11:06:36 +01:00
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_amendments_enabled",
|
2016-06-02 12:47:01 +02:00
|
|
|
default_value=False,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="boolean",
|
|
|
|
label="Activate amendments",
|
2019-02-07 12:34:31 +01:00
|
|
|
weight=339,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Amendments",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
2018-08-16 14:31:18 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_amendments_main_table",
|
2018-08-16 14:31:18 +02:00
|
|
|
default_value=False,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="boolean",
|
|
|
|
label="Show amendments together with motions",
|
2019-02-07 12:34:31 +01:00
|
|
|
weight=340,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Amendments",
|
|
|
|
)
|
2018-08-16 14:31:18 +02:00
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_amendments_prefix",
|
|
|
|
default_value="-",
|
|
|
|
label="Prefix for the identifier for amendments",
|
2019-02-07 12:34:31 +01:00
|
|
|
weight=341,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Amendments",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
2016-08-19 21:03:14 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_amendments_text_mode",
|
|
|
|
default_value="freestyle",
|
|
|
|
input_type="choice",
|
|
|
|
label="How to create new amendments",
|
2018-06-12 13:43:28 +02:00
|
|
|
choices=(
|
2019-01-06 16:22:33 +01:00
|
|
|
{"value": "freestyle", "display_name": "Empty text field"},
|
|
|
|
{"value": "fulltext", "display_name": "Edit the whole motion text"},
|
|
|
|
{"value": "paragraph", "display_name": "Paragraph-based, Diff-enabled"},
|
2018-06-12 13:43:28 +02:00
|
|
|
),
|
2016-08-19 21:03:14 +02:00
|
|
|
weight=342,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Amendments",
|
|
|
|
)
|
2016-08-19 21:03:14 +02:00
|
|
|
|
2019-04-06 13:24:21 +02:00
|
|
|
yield ConfigVariable(
|
|
|
|
name="motions_amendments_multiple_paragraphs",
|
|
|
|
default_value=False,
|
|
|
|
input_type="boolean",
|
|
|
|
label="Amendments can change multiple paragraphs",
|
|
|
|
weight=343,
|
|
|
|
group="Motions",
|
|
|
|
subgroup="Amendments",
|
|
|
|
)
|
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
# Supporters
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_min_supporters",
|
2016-06-02 12:47:01 +02:00
|
|
|
default_value=0,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="integer",
|
|
|
|
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,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Supporters",
|
|
|
|
validators=(MinValueValidator(0),),
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_remove_supporters",
|
2016-06-02 12:47:01 +02:00
|
|
|
default_value=False,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="boolean",
|
|
|
|
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,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Supporters",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
# Voting and ballot papers
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_poll_100_percent_base",
|
|
|
|
default_value="YES_NO_ABSTAIN",
|
|
|
|
input_type="choice",
|
|
|
|
label="The 100 % base of a voting result consists of",
|
2016-08-26 13:46:57 +02:00
|
|
|
choices=(
|
2019-01-06 16:22:33 +01:00
|
|
|
{"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,
|
2019-01-06 16:22:33 +01: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(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_poll_default_majority_method",
|
|
|
|
default_value=majorityMethods[0]["value"],
|
|
|
|
input_type="choice",
|
2018-11-22 12:33:40 +01:00
|
|
|
choices=majorityMethods,
|
2019-01-06 16:22:33 +01: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,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Voting and ballot papers",
|
|
|
|
)
|
2016-10-12 17:28:18 +02:00
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_pdf_ballot_papers_selection",
|
|
|
|
default_value="CUSTOM_NUMBER",
|
|
|
|
input_type="choice",
|
|
|
|
label="Number of ballot papers (selection)",
|
2016-06-02 12:47:01 +02:00
|
|
|
choices=(
|
2019-01-06 16:22:33 +01: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,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Voting and ballot papers",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_pdf_ballot_papers_number",
|
2016-06-02 12:47:01 +02:00
|
|
|
default_value=8,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="integer",
|
|
|
|
label="Custom number of ballot papers",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=365,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Voting and ballot papers",
|
|
|
|
validators=(MinValueValidator(1),),
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
2016-09-13 11:54:30 +02:00
|
|
|
# PDF and DOCX export
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_export_title",
|
|
|
|
default_value="Motions",
|
|
|
|
label="Title for PDF and DOCX documents (all motions)",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=370,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Export",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="motions_export_preamble",
|
|
|
|
default_value="",
|
|
|
|
label="Preamble text for PDF and DOCX documents (all motions)",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=375,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Motions",
|
|
|
|
subgroup="Export",
|
|
|
|
)
|