BindingDict inherits from collections.MutableMapping. Closes #2135.

This commit is contained in:
Tom Christie 2014-12-02 15:15:21 +00:00
parent 0359e9250d
commit 33096a1de6

View File

@ -1,3 +1,4 @@
import collections
from rest_framework.compat import OrderedDict from rest_framework.compat import OrderedDict
@ -70,7 +71,7 @@ class NestedBoundField(BoundField):
return BoundField(field, value, error, prefix=self.name + '.') 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. This dict-like object is used to store fields on a serializer.
@ -92,11 +93,8 @@ class BindingDict(object):
def __delitem__(self, key): def __delitem__(self, key):
del self.fields[key] del self.fields[key]
def items(self): def __iter__(self):
return self.fields.items() return iter(self.fields)
def keys(self): def __len__(self):
return self.fields.keys() return len(self.fields)
def values(self):
return self.fields.values()