Merge pull request #4921 from AlanCoding/jobs_others_opt

Low hanging query optimizations
This commit is contained in:
Alan Rominger
2017-01-25 11:57:08 -05:00
committed by GitHub
2 changed files with 19 additions and 17 deletions

View File

@@ -697,6 +697,7 @@ class OrganizationList(OrganizationCountsMixin, ListCreateAPIView):
def get_queryset(self):
qs = Organization.accessible_objects(self.request.user, 'read_role')
qs = qs.select_related('admin_role', 'auditor_role', 'member_role', 'read_role')
qs = qs.prefetch_related('created_by', 'modified_by')
return qs
def create(self, request, *args, **kwargs):