mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 01:57:00 +03:00
BindingDict inherits from collections.MutableMapping. Closes #2135.
This commit is contained in:
parent
0359e9250d
commit
33096a1de6
|
@ -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()
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user