Matthew Schinckel  committed c671586

Reduce the number of queries when we are getting an instance.

  • Participants
  • Parent commits c0d30fc
  • Branches default

Comments (0)

Files changed (1)

File rest_api/

         return self.queryset(request)
     def read(self, request, pk):
-        qs = self.queryset(request).filter(pk=pk)
-        if self.has_view_permission(request, qs.get()):
-            return qs
+        obj = self.queryset(request).get(pk=pk)
+        if self.has_view_permission(request, obj):
+            return obj
         raise http.Forbidden()
     def create(self, request):