[PATCH] views: Update how patch counts are retrieved

Stephen Finucane stephen at that.guru
Thu Oct 20 18:00:59 AEDT 2016


It's no longer possible to access 'Project.patch_set' as
'Project.submission_set' has replaced it. This was missed when the
cover letter feature was merged, so resolve it now.

Signed-off-by: Stephen Finucane <stephen at that.guru>
Closes-bug: #54
---
 patchwork/views/project.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/patchwork/views/project.py b/patchwork/views/project.py
index 461618b..4c59c10 100644
--- a/patchwork/views/project.py
+++ b/patchwork/views/project.py
@@ -25,6 +25,7 @@ from django.core import urlresolvers
 from django.http import HttpResponseRedirect
 from django.shortcuts import get_object_or_404, render
 
+from patchwork.models import Patch
 from patchwork.models import Project
 
 
@@ -44,13 +45,14 @@ def projects(request):
 
 def project(request, project_id):
     project = get_object_or_404(Project, linkname=project_id)
+    patches = Patch.objects.filter(project=project)
 
     context = {
         'project': project,
         'maintainers': User.objects.filter(
             profile__maintainer_projects=project),
-        'n_patches': project.patch_set.filter(archived=False).count(),
-        'n_archived_patches': project.patch_set.filter(archived=True).count(),
+        'n_patches': patches.filter(archived=False).count(),
+        'n_archived_patches': patches.filter(archived=True).count(),
         'enable_xmlrpc': settings.ENABLE_XMLRPC,
     }
     return render(request, 'patchwork/project.html', context)
-- 
2.7.4



More information about the Patchwork mailing list