Only preemptively check the cache on GET requests

This commit is contained in:
George Hickman 2013-04-02 10:46:48 +01:00
parent cede7d86a3
commit 5e5de9c499
2 changed files with 4 additions and 1 deletions

View File

@ -97,6 +97,10 @@ class RetrieveModelMixin(object):
Should be mixed in with `SingleObjectAPIView`.
"""
def retrieve(self, request, *args, **kwargs):
cached_object = self.check_preemptive_cache(request)
if cached_object:
return cached_object
queryset = self.get_queryset()
filtered_queryset = self.filter_queryset(queryset)
self.object = self.get_object(filtered_queryset)

View File

@ -350,7 +350,6 @@ class APIView(View):
self.perform_authentication(request)
self.check_permissions(request)
self.check_throttles(request)
self.check_preemptive_cache(request)
# Perform content negotiation and store the accepted info on the request
neg = self.perform_content_negotiation(request)