fix: Make the instance variable of child serializer point to the correct list object instead of the entire list when validating ListSerializer

This commit is contained in:
Saadullah Aleem 2023-05-11 01:19:12 +05:00
parent f969143c95
commit a1f03d5ee6

View File

@ -612,7 +612,7 @@ class ListSerializer(BaseSerializer):
if kwargs.get('instance', []) and kwargs.get('data', []): if kwargs.get('instance', []) and kwargs.get('data', []):
assert len(kwargs.get("data", [])) == len( assert len(kwargs.get("data", [])) == len(
kwargs.get("instance", [])), 'Data and instance should have same length' kwargs.get("instance", [])), 'Data and instance should have same length'
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.child.bind(field_name='', parent=self) self.child.bind(field_name='', parent=self)