[PATCH 09/10] views: fixed filter error in about-project view

WEN Pingbo wengpingbo at gmail.com
Tue Aug 23 19:03:43 AEST 2016


After we added patch series and patch version, we can't filter patch in
this way.

Signed-off-by: WEN Pingbo <wengpingbo at gmail.com>
---
 patchwork/views/project.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/patchwork/views/project.py b/patchwork/views/project.py
index ea876b3..fd15442 100644
--- a/patchwork/views/project.py
+++ b/patchwork/views/project.py
@@ -25,7 +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 Project
+from patchwork.models import Project, Patch
 
 
 def list(request):
@@ -50,8 +50,8 @@ def project(request, project_id):
         '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': Patch.objects.filter(project=project, archived=False).count(),
+        'n_archived_patches': Patch.objects.filter(project=project, archived=True).count(),
         'enable_xmlrpc': settings.ENABLE_XMLRPC,
     }
     return render(request, 'patchwork/project.html', context)
-- 
1.9.1



More information about the Patchwork mailing list