Binding child should happen in bind no init

It should fix several issues related to child caching wrong root, the one I was dealing with was that child of a `many=True` serializer didn't have access to context.
This commit is contained in:
Sassan Haradji 2017-08-03 17:47:40 +04:30 committed by GitHub
parent 83c535e9cc
commit 7dfc791841

View File

@ -563,10 +563,10 @@ class ListSerializer(BaseSerializer):
assert self.child is not None, '`child` is a required argument.'
assert not inspect.isclass(self.child), '`child` has not been instantiated.'
super(ListSerializer, self).__init__(*args, **kwargs)
self.child.bind(field_name='', parent=self)
def bind(self, field_name, parent):
super(ListSerializer, self).bind(field_name, parent)
self.child.bind(field_name='', parent=self)
self.partial = self.parent.partial
def get_initial(self):