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 _
|
2016-02-09 00:11:48 +01:00
|
|
|
from django.utils.translation import pgettext, ugettext_lazy, ugettext_noop
|
2013-01-26 16:33:55 +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-11 21:32:09 +01:00
|
|
|
|
2013-09-25 10:01:01 +02:00
|
|
|
from .models import State, Workflow
|
2013-01-26 16:33:55 +01:00
|
|
|
|
2013-02-02 10:24:28 +01:00
|
|
|
|
2013-12-02 19:33:43 +01:00
|
|
|
def setup_motion_config(sender, **kwargs):
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
2015-06-17 18:32:05 +02:00
|
|
|
Receiver function to setup all motion config variables. They are
|
|
|
|
grouped in 'General', 'Amendments', 'Supporters', 'Voting and ballot
|
|
|
|
papers' and 'PDF'. This function connected to the signal
|
2015-06-29 12:08:15 +02:00
|
|
|
openslides.core.signals.config_signal during app loading.
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
2014-01-31 00:55:18 +01:00
|
|
|
# General
|
2015-06-17 18:32:05 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_workflow',
|
2014-05-28 00:20:13 +02:00
|
|
|
default_value='1',
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='choice',
|
|
|
|
label=ugettext_lazy('Workflow of new motions'),
|
|
|
|
choices=({'value': str(workflow.pk), 'display_name': ugettext_lazy(workflow.name)} for workflow in Workflow.objects.all()),
|
|
|
|
weight=310,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('General'))
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_identifier',
|
2014-01-31 00:55:18 +01:00
|
|
|
default_value='per_category',
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='choice',
|
|
|
|
label=ugettext_lazy('Identifier'),
|
|
|
|
choices=(
|
|
|
|
{'value': 'per_category', 'display_name': ugettext_lazy('Numbered per category')},
|
|
|
|
{'value': 'serially_numbered', 'display_name': ugettext_lazy('Serially numbered')},
|
|
|
|
{'value': 'manually', 'display_name': ugettext_lazy('Set it manually')}),
|
|
|
|
weight=315,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('General'))
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_preamble',
|
2014-01-31 00:55:18 +01:00
|
|
|
default_value=_('The assembly may decide,'),
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Motion preamble'),
|
|
|
|
weight=320,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('General'),
|
|
|
|
translatable=True)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_stop_submitting',
|
2013-04-03 00:40:56 +02:00
|
|
|
default_value=False,
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='boolean',
|
|
|
|
label=ugettext_lazy('Stop submitting new motions by non-staff users'),
|
|
|
|
weight=325,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('General'))
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_allow_disable_versioning',
|
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('Allow to disable versioning'),
|
|
|
|
weight=330,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('General'))
|
2014-01-31 00:55:18 +01:00
|
|
|
|
2014-12-25 10:58:52 +01:00
|
|
|
# Amendments
|
2016-02-10 17:49:44 +01:00
|
|
|
# Amendments currently not implemented. (TODO: Implement it like in OpenSlides 1.7.)
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_amendments_enabled',
|
2014-12-25 10:58:52 +01:00
|
|
|
default_value=False,
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='boolean',
|
|
|
|
label=ugettext_lazy('Activate amendments'),
|
2016-02-14 21:38:26 +01:00
|
|
|
hidden=True,
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=335,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('Amendments'))
|
2014-12-25 10:58:52 +01:00
|
|
|
|
2015-06-17 18:32:05 +02:00
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_amendments_prefix',
|
2015-01-11 19:04:21 +01:00
|
|
|
default_value=pgettext('Prefix for the identifier for amendments', 'A'),
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Prefix for the identifier for amendments'),
|
2016-02-14 21:38:26 +01:00
|
|
|
hidden=True,
|
2015-06-17 18:32:05 +02:00
|
|
|
weight=340,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('Amendments'))
|
2014-12-25 10:58:52 +01:00
|
|
|
|
2014-01-31 00:55:18 +01:00
|
|
|
# Supporters
|
2015-06-17 18:32:05 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_min_supporters',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value=0,
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='integer',
|
|
|
|
label=ugettext_lazy('Number of (minimum) required supporters for a motion'),
|
|
|
|
help_text=ugettext_lazy('Choose 0 to disable the supporting system.'),
|
|
|
|
weight=345,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('Supporters'),
|
|
|
|
validators=(MinValueValidator(0),))
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_remove_supporters',
|
2013-05-31 18:30:03 +02:00
|
|
|
default_value=False,
|
2015-06-17 18:32:05 +02:00
|
|
|
input_type='boolean',
|
|
|
|
label=ugettext_lazy('Remove all supporters of a motion if a submitter edits his motion in early state'),
|
|
|
|
weight=350,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('Supporters'))
|
2014-01-31 00:55:18 +01:00
|
|
|
|
2014-04-10 20:18:22 +02:00
|
|
|
# Voting and ballot papers
|
2015-06-17 18:32:05 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_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 a voting result consists of'),
|
|
|
|
choices=PERCENT_BASE_CHOICES,
|
|
|
|
weight=355,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('Voting and ballot papers'))
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_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=360,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('Voting and ballot papers'))
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_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=365,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('Voting and ballot papers'),
|
|
|
|
validators=(MinValueValidator(1),))
|
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='motions_pdf_title',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value=_('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Title for PDF document (all motions)'),
|
|
|
|
weight=370,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('PDF'),
|
|
|
|
translatable=True)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_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 motions)'),
|
|
|
|
weight=375,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('PDF'))
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2015-06-16 18:12:59 +02:00
|
|
|
name='motions_pdf_paragraph_numbering',
|
2013-09-02 21:03:27 +02:00
|
|
|
default_value=False,
|
2016-02-10 17:49:44 +01:00
|
|
|
input_type='boolean',
|
2015-06-17 18:32:05 +02:00
|
|
|
label=ugettext_lazy('Show paragraph numbering (only in PDF)'),
|
|
|
|
weight=380,
|
2016-04-12 19:45:44 +02:00
|
|
|
group=ugettext_lazy('Motions'),
|
2015-06-17 18:32:05 +02:00
|
|
|
subgroup=ugettext_lazy('PDF'))
|
2013-03-11 21:32:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
def create_builtin_workflows(sender, **kwargs):
|
|
|
|
"""
|
2014-11-13 22:23:16 +01:00
|
|
|
Receiver function to create a simple and a complex workflow. It is
|
|
|
|
connected to the signal openslides.core.signals.post_database_setup
|
|
|
|
during app loading.
|
2013-03-11 21:32:09 +01:00
|
|
|
"""
|
2015-01-16 14:18:34 +01:00
|
|
|
if Workflow.objects.exists():
|
|
|
|
# If there is at least one workflow, then do nothing.
|
|
|
|
return
|
2013-03-11 21:32:09 +01:00
|
|
|
|
2016-01-22 20:46:20 +01:00
|
|
|
workflow_1 = Workflow.objects.create(name='Simple Workflow')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_1_1 = State.objects.create(name=ugettext_noop('submitted'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_1,
|
|
|
|
allow_create_poll=True,
|
|
|
|
allow_support=True,
|
|
|
|
allow_submitter_edit=True)
|
2016-02-09 00:11:48 +01:00
|
|
|
state_1_2 = State.objects.create(name=ugettext_noop('accepted'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_1,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Accept',
|
2015-11-03 21:38:53 +01:00
|
|
|
css_class='success')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_1_3 = State.objects.create(name=ugettext_noop('rejected'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_1,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Reject',
|
2015-11-03 21:38:53 +01:00
|
|
|
css_class='danger')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_1_4 = State.objects.create(name=ugettext_noop('not decided'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_1,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Do not decide',
|
2015-11-03 21:38:53 +01:00
|
|
|
css_class='default')
|
2015-01-16 14:18:34 +01:00
|
|
|
state_1_1.next_states.add(state_1_2, state_1_3, state_1_4)
|
|
|
|
workflow_1.first_state = state_1_1
|
|
|
|
workflow_1.save()
|
|
|
|
|
2016-01-22 20:46:20 +01:00
|
|
|
workflow_2 = Workflow.objects.create(name='Complex Workflow')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_1 = State.objects.create(name=ugettext_noop('published'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
|
|
|
allow_support=True,
|
|
|
|
allow_submitter_edit=True,
|
|
|
|
dont_set_identifier=True)
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_2 = State.objects.create(name=ugettext_noop('permitted'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Permit',
|
2015-01-16 14:18:34 +01:00
|
|
|
allow_create_poll=True,
|
|
|
|
allow_submitter_edit=True,
|
|
|
|
versioning=True,
|
|
|
|
leave_old_version_active=True)
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_3 = State.objects.create(name=ugettext_noop('accepted'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Accept',
|
2015-11-03 21:38:53 +01:00
|
|
|
versioning=True,
|
|
|
|
css_class='success')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_4 = State.objects.create(name=ugettext_noop('rejected'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Reject',
|
2015-11-03 21:38:53 +01:00
|
|
|
versioning=True,
|
|
|
|
css_class='danger')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_5 = State.objects.create(name=ugettext_noop('withdrawed'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Withdraw',
|
2015-11-03 21:38:53 +01:00
|
|
|
versioning=True,
|
|
|
|
css_class='default')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_6 = State.objects.create(name=ugettext_noop('adjourned'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Adjourn',
|
2015-11-03 21:38:53 +01:00
|
|
|
versioning=True,
|
|
|
|
css_class='default')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_7 = State.objects.create(name=ugettext_noop('not concerned'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Do not concern',
|
2015-11-03 21:38:53 +01:00
|
|
|
versioning=True,
|
|
|
|
css_class='default')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_8 = State.objects.create(name=ugettext_noop('commited a bill'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Commit a bill',
|
2015-11-03 21:38:53 +01:00
|
|
|
versioning=True,
|
|
|
|
css_class='default')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_9 = State.objects.create(name=ugettext_noop('needs review'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Needs review',
|
2015-11-03 21:38:53 +01:00
|
|
|
versioning=True,
|
|
|
|
css_class='default')
|
2016-02-09 00:11:48 +01:00
|
|
|
state_2_10 = State.objects.create(name=ugettext_noop('rejected (not authorized)'),
|
2015-01-16 14:18:34 +01:00
|
|
|
workflow=workflow_2,
|
2016-01-22 20:46:20 +01:00
|
|
|
action_word='Reject (not authorized)',
|
2015-11-03 21:38:53 +01:00
|
|
|
versioning=True,
|
|
|
|
css_class='default')
|
2015-01-16 14:18:34 +01:00
|
|
|
state_2_1.next_states.add(state_2_2, state_2_5, state_2_10)
|
|
|
|
state_2_2.next_states.add(state_2_3, state_2_4, state_2_5, state_2_6, state_2_7, state_2_8, state_2_9)
|
|
|
|
workflow_2.first_state = state_2_1
|
|
|
|
workflow_2.save()
|