diff --git a/apps/patchwork/forms.py b/apps/patchwork/forms.py index 10fffb8..2c57c08 100644 --- a/apps/patchwork/forms.py +++ b/apps/patchwork/forms.py @@ -197,7 +197,7 @@ class MultipleBooleanField(forms.ChoiceField): raise ValueError('Unknown value: %s' % value) class MultiplePatchForm(forms.Form): - actions = ['update'] + action = 'update' state = OptionalModelChoiceField(queryset = State.objects.all()) archived = MultipleBooleanField() @@ -206,7 +206,7 @@ class MultiplePatchForm(forms.Form): self.fields['delegate'] = OptionalDelegateField(project = project, required = False) - def save(self, instance): + def save(self, instance, commit = True): opts = instance.__class__._meta if self.errors: raise ValueError("The %s could not be changed because the data " @@ -226,7 +226,8 @@ class MultiplePatchForm(forms.Form): setattr(instance, f.name, data[f.name]) - instance.save() + if commit: + instance.save() return instance class UserPersonLinkForm(forms.Form): diff --git a/apps/patchwork/views/__init__.py b/apps/patchwork/views/__init__.py index c9b16b9..f66a2bf 100644 --- a/apps/patchwork/views/__init__.py +++ b/apps/patchwork/views/__init__.py @@ -60,7 +60,7 @@ def generic_list(request, project, view, if action in bundle_actions: errors = set_bundle(user, project, action, data, ps, context) - elif properties_form and action in properties_form.actions: + elif properties_form and action == properties_form.action: errors = process_multiplepatch_form( properties_form, user, action, ps, context) else: @@ -98,7 +98,7 @@ def generic_list(request, project, view, def process_multiplepatch_form(form, user, action, patches, context): errors = [] - if not form.is_valid() or action not in form.actions: + if not form.is_valid() or action != form.action: return ['The submitted form data was invalid'] if len(patches) == 0: diff --git a/templates/patchwork/patch-list.html b/templates/patchwork/patch-list.html index 43e0550..12c5d0c 100644 --- a/templates/patchwork/patch-list.html +++ b/templates/patchwork/patch-list.html @@ -186,7 +186,7 @@