Fixed bug with workflows. Fixed #1309.

This commit is contained in:
Norman Jäckel 2014-05-28 00:20:13 +02:00
parent c5db1c5e02
commit 52f7dff0f1
4 changed files with 7 additions and 7 deletions

View File

@ -21,12 +21,12 @@ def setup_motion_config(sender, **kwargs):
# General
motion_workflow = ConfigVariable(
name='motion_workflow',
default_value=1,
default_value='1',
form_field=forms.ChoiceField(
widget=forms.Select(),
label=ugettext_lazy('Workflow of new motions'),
required=True,
choices=[(workflow.pk, ugettext_lazy(workflow.name)) for workflow in Workflow.objects.all()]))
choices=[(str(workflow.pk), ugettext_lazy(workflow.name)) for workflow in Workflow.objects.all()]))
motion_identifier = ConfigVariable(
name='motion_identifier',
default_value='per_category',

View File

@ -197,7 +197,7 @@ class MotionCreateView(MotionEditMixin, CreateView):
Sets first state according to given or default workflow and initiates
a new version.
"""
workflow = form.cleaned_data.get('workflow', config['motion_workflow'])
workflow = form.cleaned_data.get('workflow', int(config['motion_workflow']))
self.object.reset_state(workflow)
self.version = self.object.get_new_version()

View File

@ -27,7 +27,7 @@ class HandleConfigTest(TestCase):
self.assertEqual(config['string_var'], 'default_string_rien4ooCZieng6ah')
self.assertTrue(config['bool_var'])
self.assertEqual(config['integer_var'], 3)
self.assertEqual(config['choices_var'], 1)
self.assertEqual(config['choices_var'], '1')
self.assertEqual(config['none_config_var'], None)
self.assertRaisesMessage(expected_exception=ConfigNotFound,
expected_message='The config variable unknown_config_var was not found.',
@ -308,8 +308,8 @@ def set_grouped_config_view(sender, **kwargs):
default_value='hidden_value')
choices_var = ConfigVariable(
name='choices_var',
default_value=1,
form_field=forms.ChoiceField(choices=((1, 'Choice One Ughoch4ocoche6Ee'), (2, 'Choice Two Vahnoh5yalohv5Eb'))))
default_value='1',
form_field=forms.ChoiceField(choices=(('1', 'Choice One Ughoch4ocoche6Ee'), ('2', 'Choice Two Vahnoh5yalohv5Eb'))))
group_2 = ConfigGroup(title='Group 2 Toongai7ahyahy7B', variables=(hidden_var, choices_var))
return ConfigGroupedCollection(

View File

@ -120,7 +120,7 @@ class TestMotionCreateView(MotionViewTestCase):
response = self.admin_client.post(self.url, {'title': 'new motion',
'text': 'motion text',
'reason': 'motion reason',
'workflow': 1})
'workflow': '1'})
self.assertEqual(response.status_code, 302)
self.assertTrue(Motion.objects.filter(versions__title='new motion').exists())