@@ -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):
@@ -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:
@@ -186,7 +186,7 @@
<tr>
<td></td>
<td>
- <input type="submit" name="action" value="Update"/>
+ <input type="submit" name="action" value="{{patchform.action}}"/>
</td>
</tr>
</table>