From 362e2f154f847833dcf1cbb52b34b4cf844c804a Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Thu, 6 Dec 2018 11:47:33 +0100 Subject: [PATCH] removed action word from states --- .../app/shared/models/motions/workflow-state.ts | 1 - .../migrations/0017_remove_state_action_word.py | 17 +++++++++++++++++ openslides/motions/models.py | 7 ------- openslides/motions/serializers.py | 2 -- openslides/motions/signals.py | 12 ------------ tests/old/motions/test_models.py | 1 - 6 files changed, 17 insertions(+), 23 deletions(-) create mode 100644 openslides/motions/migrations/0017_remove_state_action_word.py diff --git a/client/src/app/shared/models/motions/workflow-state.ts b/client/src/app/shared/models/motions/workflow-state.ts index ac649ac7c..5b5020621 100644 --- a/client/src/app/shared/models/motions/workflow-state.ts +++ b/client/src/app/shared/models/motions/workflow-state.ts @@ -19,7 +19,6 @@ export enum MergeAmendment { export class WorkflowState extends Deserializer { public id: number; public name: string; - public action_word: string; public recommendation_label: string; public css_class: string; public required_permission_to_see: string; diff --git a/openslides/motions/migrations/0017_remove_state_action_word.py b/openslides/motions/migrations/0017_remove_state_action_word.py new file mode 100644 index 000000000..e0265cd2c --- /dev/null +++ b/openslides/motions/migrations/0017_remove_state_action_word.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.3 on 2018-12-06 10:38 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('motions', '0016_merge_amendment_into_final'), + ] + + operations = [ + migrations.RemoveField( + model_name='state', + name='action_word', + ), + ] diff --git a/openslides/motions/models.py b/openslides/motions/models.py index 7690f39a0..936966397 100644 --- a/openslides/motions/models.py +++ b/openslides/motions/models.py @@ -1043,9 +1043,6 @@ class State(RESTModelMixin, models.Model): name = models.CharField(max_length=255) """A string representing the state.""" - action_word = models.CharField(max_length=255, blank=True) - """An alternative string to be used for a button to switch to this state.""" - recommendation_label = models.CharField(max_length=255, null=True) """A string for a recommendation to set the motion to this state.""" @@ -1139,10 +1136,6 @@ class State(RESTModelMixin, models.Model): 'be an empty string.'.format(self)) super(State, self).save(**kwargs) - def get_action_word(self): - """Returns the alternative name of the state if it exists.""" - return self.action_word or self.name - def check_next_states(self): """Checks whether all next states of a state belong to the correct workflow.""" # No check if it is a new state which has not been saved yet. diff --git a/openslides/motions/serializers.py b/openslides/motions/serializers.py index c4f303ed9..2ed93be1b 100644 --- a/openslides/motions/serializers.py +++ b/openslides/motions/serializers.py @@ -94,7 +94,6 @@ class StateSerializer(ModelSerializer): fields = ( 'id', 'name', - 'action_word', 'recommendation_label', 'css_class', 'required_permission_to_see', @@ -129,7 +128,6 @@ class WorkflowSerializer(ModelSerializer): workflow = super().create(validated_data) first_state = State.objects.create( name='new', - action_word='new', workflow=workflow, allow_create_poll=True, allow_support=True, diff --git a/openslides/motions/signals.py b/openslides/motions/signals.py index ffaefacd1..1a6bcae39 100644 --- a/openslides/motions/signals.py +++ b/openslides/motions/signals.py @@ -24,20 +24,17 @@ def create_builtin_workflows(sender, **kwargs): state_1_1.save(skip_autoupdate=True) state_1_2 = State(name=ugettext_noop('accepted'), workflow=workflow_1, - action_word='Accept', recommendation_label='Acceptance', css_class='success', merge_amendment_into_final=True) state_1_2.save(skip_autoupdate=True) state_1_3 = State(name=ugettext_noop('rejected'), workflow=workflow_1, - action_word='Reject', recommendation_label='Rejection', css_class='danger') state_1_3.save(skip_autoupdate=True) state_1_4 = State(name=ugettext_noop('not decided'), workflow=workflow_1, - action_word='Do not decide', recommendation_label='No decision', css_class='default') state_1_4.save(skip_autoupdate=True) @@ -55,55 +52,46 @@ def create_builtin_workflows(sender, **kwargs): state_2_1.save(skip_autoupdate=True) state_2_2 = State(name=ugettext_noop('permitted'), workflow=workflow_2, - action_word='Permit', recommendation_label='Permission', allow_create_poll=True, allow_submitter_edit=True) state_2_2.save(skip_autoupdate=True) state_2_3 = State(name=ugettext_noop('accepted'), workflow=workflow_2, - action_word='Accept', recommendation_label='Acceptance', css_class='success', merge_amendment_into_final=True) state_2_3.save(skip_autoupdate=True) state_2_4 = State(name=ugettext_noop('rejected'), workflow=workflow_2, - action_word='Reject', recommendation_label='Rejection', css_class='danger') state_2_4.save(skip_autoupdate=True) state_2_5 = State(name=ugettext_noop('withdrawed'), workflow=workflow_2, - action_word='Withdraw', css_class='default') state_2_5.save(skip_autoupdate=True) state_2_6 = State(name=ugettext_noop('adjourned'), workflow=workflow_2, - action_word='Adjourn', recommendation_label='Adjournment', css_class='default') state_2_6.save(skip_autoupdate=True) state_2_7 = State(name=ugettext_noop('not concerned'), workflow=workflow_2, - action_word='Do not concern', recommendation_label='No concernment', css_class='default') state_2_7.save(skip_autoupdate=True) state_2_8 = State(name=ugettext_noop('refered to committee'), workflow=workflow_2, - action_word='Refer to committee', recommendation_label='Referral to committee', css_class='default') state_2_8.save(skip_autoupdate=True) state_2_9 = State(name=ugettext_noop('needs review'), workflow=workflow_2, - action_word='Needs review', css_class='default') state_2_9.save(skip_autoupdate=True) state_2_10 = State(name=ugettext_noop('rejected (not authorized)'), workflow=workflow_2, - action_word='Reject (not authorized)', recommendation_label='Rejection (not authorized)', css_class='default') state_2_10.save(skip_autoupdate=True) diff --git a/tests/old/motions/test_models.py b/tests/old/motions/test_models.py index 9f742553c..b7133b026 100644 --- a/tests/old/motions/test_models.py +++ b/tests/old/motions/test_models.py @@ -30,7 +30,6 @@ class ModelTest(TestCase): self.motion.state = State.objects.get(pk=6) self.assertEqual(self.motion.state.name, 'permitted') - self.assertEqual(self.motion.state.get_action_word(), 'Permit') def test_new_states_or_workflows(self): workflow_1 = Workflow.objects.create(name='W1')