Commit dcdd7656 by Xavier Ordoquy

Avoid passing allow_empty to the ListSerializer children.

parent 39ec564a
...@@ -113,8 +113,12 @@ class BaseSerializer(Field): ...@@ -113,8 +113,12 @@ class BaseSerializer(Field):
kwargs['child'] = cls() kwargs['child'] = cls()
return CustomListSerializer(*args, **kwargs) return CustomListSerializer(*args, **kwargs)
""" """
allow_empty = kwargs.pop('allow_empty', True)
child_serializer = cls(*args, **kwargs) child_serializer = cls(*args, **kwargs)
list_kwargs = {'child': child_serializer} list_kwargs = {
'child': child_serializer,
'allow_empty': allow_empty,
}
list_kwargs.update(dict([ list_kwargs.update(dict([
(key, value) for key, value in kwargs.items() (key, value) for key, value in kwargs.items()
if key in LIST_SERIALIZER_KWARGS if key in LIST_SERIALIZER_KWARGS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment