]> git.ozlabs.org Git - patchwork/blobdiff - patchwork/views/__init__.py
Add missing explicit state fixture load
[patchwork] / patchwork / views / __init__.py
index dfca56dd690c990fbd004f38810877a842197253..b64f6041eca006bb800f190c0b2183f5e9b3c3ac 100644 (file)
@@ -50,15 +50,19 @@ def generic_list(request, project, view,
             list_view_params = view_args)
 
     context.project = project
-    order = Order(request.REQUEST.get('order'), editable = editable_order)
+    data = {}
+    if request.method == 'GET':
+        data = request.GET
+    elif request.method == 'POST':
+        data = request.POST
+    order = Order(data.get('order'), editable=editable_order)
 
     # Explicitly set data to None because request.POST will be an empty dict
     # when the form is not submitted, but passing a non-None data argument to
     # a forms.Form will make it bound and we don't want that to happen unless
     # there's been a form submission.
-    data = None
-    if request.method == 'POST':
-        data = request.POST
+    if request.method != 'POST':
+        data = None
     user = request.user
     properties_form = None
     if project.is_editable(user):
@@ -104,6 +108,9 @@ def generic_list(request, project, view,
     if patches is None:
         patches = Patch.objects.filter(project=project)
 
+    # annotate with tag counts
+    patches = patches.with_tag_counts(project)
+
     patches = context.filters.apply(patches)
     if not editable_order:
         patches = order.apply(patches)
@@ -114,7 +121,7 @@ def generic_list(request, project, view,
 
     # but we will need to follow the state and submitter relations for
     # rendering the list template
-    patches = patches.select_related('state', 'submitter')
+    patches = patches.select_related('state', 'submitter', 'delegate')
 
     paginator = Paginator(request, patches)