]> git.ozlabs.org Git - patchwork/commitdiff
forms: Only pass post data to multiplepatchform if that was what was submitted
authorJeremy Kerr <jk@ozlabs.org>
Sun, 30 Dec 2012 05:57:18 +0000 (13:57 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Sun, 30 Dec 2012 05:59:52 +0000 (13:59 +0800)
When updating bundles, we get a spurious error message in the
MultiplePatchForm; it's performing validation on the blank form data.

This change only passes the post data to the MuliplePatchForm if we
detect (through data['form']) that it was the MultiplePatchForm that was
submitted.

This fixes the current testsuite failure.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/views/__init__.py

index bae40c6d6eb51cac6ee9ef303070e2a69ed80586..a9943e7938f8b1677bc41b7e4a43ed5b2f814033 100644 (file)
@@ -44,7 +44,14 @@ def generic_list(request, project, view,
     user = request.user
     properties_form = None
     if project.is_editable(user):
-        properties_form = MultiplePatchForm(project, data = data)
+
+        # we only pass the post data to the MultiplePatchForm if that was
+        # the actual form submitted
+        data_tmp = None
+        if data and data.get('form', '') == 'patchlistform':
+            data_tmp = data
+
+        properties_form = MultiplePatchForm(project, data = data_tmp)
 
     if request.method == 'POST' and data.get('form') == 'patchlistform':
         action = data.get('action', '').lower()