diff options
| author | Tom Christie | 2015-01-21 14:18:13 +0000 | 
|---|---|---|
| committer | Tom Christie | 2015-01-21 14:18:13 +0000 | 
| commit | e59b3d1718de549d0e165d03aeea1488ddfe20ee (patch) | |
| tree | 121045a26ab759b7634e6f990c6b87c203d4809b /rest_framework | |
| parent | 9d24809a4dee67ee414ee79820331f0794c42a13 (diff) | |
| download | django-rest-framework-e59b3d1718de549d0e165d03aeea1488ddfe20ee.tar.bz2 | |
Make ReturnDict cachable. Closes #2360.
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/utils/serializer_helpers.py | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/rest_framework/utils/serializer_helpers.py b/rest_framework/utils/serializer_helpers.py index ab057862..87bb3ac0 100644 --- a/rest_framework/utils/serializer_helpers.py +++ b/rest_framework/utils/serializer_helpers.py @@ -19,6 +19,11 @@ class ReturnDict(OrderedDict):      def __repr__(self):          return dict.__repr__(self) +    def __reduce__(self): +        # Pickling these objects will drop the .serializer backlink, +        # but preserve the raw data. +        return (dict, (dict(self),)) +  class ReturnList(list):      """ @@ -33,6 +38,11 @@ class ReturnList(list):      def __repr__(self):          return list.__repr__(self) +    def __reduce__(self): +        # Pickling these objects will drop the .serializer backlink, +        # but preserve the raw data. +        return (list, (list(self),)) +  class BoundField(object):      """ | 
