Simplify select_related.

This commit is contained in:
Aaron Tan
2016-12-01 15:05:22 -05:00
parent e63716c0bb
commit 9f629048da

View File

@@ -1843,12 +1843,11 @@ class UnifiedJobAccess(BaseAccess):
qs = qs.select_related( qs = qs.select_related(
'created_by', 'created_by',
'modified_by', 'modified_by',
'unified_job_node__workflow_job',
) )
qs = qs.prefetch_related( qs = qs.prefetch_related(
'unified_job_template', '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. # 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. # In the future, as django and polymorphic libs are upgraded, try again.