diff mbox series

[07/11] views: Populate 'project' attribute of PatchForm

Message ID 20180415225405.1354-8-stephen@that.guru
State Superseded
Headers show
Series Add labels support | expand

Commit Message

Stephen Finucane April 15, 2018, 10:54 p.m. UTC
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@that.guru>
---
 patchwork/views/patch.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py
index 7e962e72..c1fccbc2 100644
--- a/patchwork/views/patch.py
+++ b/patchwork/views/patch.py
@@ -69,7 +69,7 @@  def patch_detail(request, patch_id):
     createbundleform = None
 
     if editable:
-        form = PatchForm(instance=patch)
+        form = PatchForm(instance=patch, project=patch.project)
     if is_authenticated(request.user):
         createbundleform = CreateBundleForm()
 
@@ -106,7 +106,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')