]> git.ozlabs.org Git - patchwork/commitdiff
patchwork/views: prefetch delegate in generic_list
authorJeremy Kerr <jk@ozlabs.org>
Thu, 4 Jun 2015 09:58:51 +0000 (17:58 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Fri, 5 Jun 2015 06:37:05 +0000 (14:37 +0800)
If patches have a delegate, the patch list template will cause a query
to render the delegate username. Instead, we should include the delegate
in the select_related query.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
patchwork/views/__init__.py

index b7916f0b7d7b7d3c26e58d47ae1819b8b3291adc..cb05a8ec7dc9e0ea619b9952eaf99744f8ea2d43 100644 (file)
@@ -117,7 +117,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)