Skip to content

Commit

Permalink
[#1365] optimized the queryset call on admin/akvopage
Browse files Browse the repository at this point in the history
  • Loading branch information
kardan committed May 7, 2015
1 parent a3fa2cb commit 4f67c05
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion akvo/rsr/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,8 +1076,11 @@ def get_list_display(self, request):

def get_queryset(self, request):
if request.user.is_admin or request.user.is_superuser:
return super(PartnerSiteAdmin, self).get_queryset(request)
print "is admin or superuser"
return super(PartnerSiteAdmin, self).get_queryset(
request).select_related('organisation')

print "was not admin or superuser"
from .models import PartnerSite
qs = PartnerSite.objects.none()
for employment in request.user.employers.approved():
Expand Down

0 comments on commit 4f67c05

Please sign in to comment.