From 9f629048dad55c98d2d0b5a19605d1cbea6ee3ac Mon Sep 17 00:00:00 2001 From: Aaron Tan Date: Thu, 1 Dec 2016 15:05:22 -0500 Subject: [PATCH] Simplify select_related. --- awx/main/access.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/awx/main/access.py b/awx/main/access.py index eb50fb244d..4ffbcf288b 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -1843,12 +1843,11 @@ class UnifiedJobAccess(BaseAccess): qs = qs.select_related( 'created_by', 'modified_by', + 'unified_job_node__workflow_job', ) qs = qs.prefetch_related( 'unified_job_template', ) - if self.model.spawned_by_workflow: - qs = qs.select_related('unified_job_node__workflow_job') # WISH - sure would be nice if the following worked, but it does not. # In the future, as django and polymorphic libs are upgraded, try again.