Fixed bug with workflows. Fixed #1309.
This commit is contained in:
parent
c5db1c5e02
commit
52f7dff0f1
@ -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',
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user