aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/utils
diff options
context:
space:
mode:
authorTom Christie2014-12-02 15:15:21 +0000
committerTom Christie2014-12-02 15:15:21 +0000
commit33096a1de6c20581caab36bc1af0e686d47483e7 (patch)
treee7736247900a844022fe790b0834090006fd326e /rest_framework/utils
parent0359e9250d34e18aef2db6216f24c130a4f51fce (diff)
downloaddjango-rest-framework-33096a1de6c20581caab36bc1af0e686d47483e7.tar.bz2
BindingDict inherits from collections.MutableMapping. Closes #2135.
Diffstat (limited to 'rest_framework/utils')
-rw-r--r--rest_framework/utils/serializer_helpers.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/rest_framework/utils/serializer_helpers.py b/rest_framework/utils/serializer_helpers.py
index 92d19857..277cf649 100644
--- a/rest_framework/utils/serializer_helpers.py
+++ b/rest_framework/utils/serializer_helpers.py
@@ -1,3 +1,4 @@
+import collections
from rest_framework.compat import OrderedDict
@@ -70,7 +71,7 @@ class NestedBoundField(BoundField):
return BoundField(field, value, error, prefix=self.name + '.')
-class BindingDict(object):
+class BindingDict(collections.MutableMapping):
"""
This dict-like object is used to store fields on a serializer.
@@ -92,11 +93,8 @@ class BindingDict(object):
def __delitem__(self, key):
del self.fields[key]
- def items(self):
- return self.fields.items()
-
- def keys(self):
- return self.fields.keys()
+ def __iter__(self):
+ return iter(self.fields)
- def values(self):
- return self.fields.values()
+ def __len__(self):
+ return len(self.fields)