mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-12-04 00:34:00 +03:00
Use enumerate for index and item in loop
This commit is contained in:
parent
54d649b8ed
commit
681582bfcf
|
|
@ -689,16 +689,14 @@ class ListSerializer(BaseSerializer):
|
|||
|
||||
ret = []
|
||||
errors = {}
|
||||
index = 0
|
||||
|
||||
for item in data:
|
||||
for index, item in enumerate(data):
|
||||
try:
|
||||
validated = self.run_child_validation(item)
|
||||
except ValidationError as exc:
|
||||
errors[index] = exc.detail
|
||||
else:
|
||||
ret.append(validated)
|
||||
index += 1
|
||||
|
||||
if errors:
|
||||
raise ValidationError(errors)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user