From 500ebdbbd20894455b2f8eea2fa30132b3cfea3e Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Mon, 18 Apr 2016 08:56:04 -0400 Subject: [PATCH] fix index error generating organization detail view context --- awx/api/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/awx/api/views.py b/awx/api/views.py index cf6849df71..f028dcb238 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -673,6 +673,9 @@ class OrganizationDetail(RetrieveUpdateDestroyAPIView): admins=Count('admin_role__members', distinct=True) ).values('users', 'admins') + if direct_counts.count() == 0: + return full_context + org_counts = direct_counts[0] org_counts['inventories'] = Inventory.accessible_objects(**access_kwargs).filter( organization__id=org_id).count()