From d430a0372120021e98a7a41fccb9da1bf4e03481 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Mon, 30 Jan 2017 17:09:38 -0500 Subject: [PATCH] adjusted prefetches from time test results --- awx/api/views.py | 1 + awx/main/access.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/api/views.py b/awx/api/views.py index 2182358999..fc860185bf 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -1681,6 +1681,7 @@ class HostList(ListCreateAPIView): always_allow_superuser = False model = Host serializer_class = HostSerializer + capabilities_prefetch = ['inventory.admin'] class HostDetail(RetrieveUpdateDestroyAPIView): diff --git a/awx/main/access.py b/awx/main/access.py index 7bef51a20f..af40ff7c55 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -1549,7 +1549,7 @@ class WorkflowJobTemplateAccess(BaseAccess): missing_credentials = [] missing_inventories = [] qs = obj.workflow_job_template_nodes - qs.select_related('unified_job_template', 'inventory', 'credential') + qs = qs.prefetch_related('unified_job_template', 'inventory__use_role', 'credential__use_role') for node in qs.all(): node_errors = {} if node.inventory and self.user not in node.inventory.use_role: