Merge pull request #4050 from FinnStutzenstein/remove_action_word

removed action word from states
This commit is contained in:
Emanuel Schütze 2018-12-13 10:05:11 +01:00 committed by GitHub
commit b900dfcba3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 23 deletions

View File

@ -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;

View File

@ -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',
),
]

View File

@ -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.

View File

@ -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,

View File

@ -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)

View File

@ -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')