[PATCH v2 07/10] views: Populate 'project' attribute of PatchForm

Stephen Finucane stephen at that.guru
Sun Oct 14 23:45:38 AEDT 2018


This is required to ensure we can filter delegates by project. If we
don't do this, our <select> gets stupid long, as seen in commit
198139e41.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/views/patch.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py
index 862dc83d..8e6cbcbd 100644
--- a/patchwork/views/patch.py
+++ b/patchwork/views/patch.py
@@ -54,7 +54,7 @@ def patch_detail(request, patch_id):
     createbundleform = None
 
     if editable:
-        form = PatchForm(instance=patch)
+        form = PatchForm(instance=patch, project=patch.project)
     if request.user.is_authenticated:
         createbundleform = CreateBundleForm()
 
@@ -91,7 +91,8 @@ def patch_detail(request, patch_id):
             return HttpResponseForbidden()
 
         elif action is None:
-            form = PatchForm(data=request.POST, instance=patch)
+            form = PatchForm(data=request.POST, instance=patch,
+                             project=patch.project)
             if form.is_valid():
                 form.save()
                 messages.success(request, 'Patch updated')
-- 
2.17.1



More information about the Patchwork mailing list