Skip to content
Snippets Groups Projects
Commit 56b3da60 authored by Fredrik Jonsson's avatar Fredrik Jonsson
Browse files

Sort the transitions by the order they are listed.

parent 3d2e02a1
No related branches found
Tags v2.6.1
No related merge requests found
......@@ -27,6 +27,9 @@ class ProgressSubmissionForm(forms.ModelForm):
self.user = kwargs.pop('user')
super().__init__(*args, **kwargs)
choices = list(self.instance.get_actions_for_user(self.user))
# Sort the transitions by the order they are listed.
sort_by = list(self.instance.phase.transitions.keys())
choices.sort(key=lambda k: sort_by.index(k[0]))
action_field = self.fields['action']
action_field.choices = choices
self.should_show = bool(choices)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment