aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rest_framework/response.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/rest_framework/response.py b/rest_framework/response.py
index 7a459c8f..006d7eeb 100644
--- a/rest_framework/response.py
+++ b/rest_framework/response.py
@@ -45,3 +45,13 @@ class Response(SimpleTemplateResponse):
# TODO: Deprecate and use a template tag instead
# TODO: Status code text for RFC 6585 status codes
return STATUS_CODE_TEXT.get(self.status_code, '')
+
+ def __getstate__(self):
+ """
+ Remove attributes from the response that shouldn't be cached
+ """
+ state = super(Response, self).__getstate__()
+ for key in ('accepted_renderer', 'renderer_context', 'data'):
+ if key in state:
+ del state[key]
+ return state