From a1f03d5ee673113d5c03ed03bcd67523bc376fc0 Mon Sep 17 00:00:00 2001 From: Saadullah Aleem Date: Thu, 11 May 2023 01:19:12 +0500 Subject: [PATCH] fix: Make the instance variable of child serializer point to the correct list object instead of the entire list when validating ListSerializer --- rest_framework/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 12723c9dc..4c1866bfc 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -612,7 +612,7 @@ class ListSerializer(BaseSerializer): if kwargs.get('instance', []) and kwargs.get('data', []): 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) self.child.bind(field_name='', parent=self)