mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-18 04:02:35 +03:00
fix formatting issues for list serializer validation fix
This commit is contained in:
parent
9ac6417aad
commit
76110bf8a5
|
@ -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)
|
||||
|
|
|
@ -11,7 +11,6 @@ from django.db import models
|
|||
|
||||
from rest_framework import exceptions, fields, relations, serializers
|
||||
from rest_framework.fields import Field
|
||||
|
||||
from .models import (
|
||||
ForeignKeyTarget, NestedForeignKeySource, NullableForeignKeySource
|
||||
)
|
||||
|
@ -837,10 +836,10 @@ class TestMultipleObjectsValidation(unittest.TestCase):
|
|||
def test_exception_raised_when_data_and_instance_length_different(self):
|
||||
|
||||
with self.assertRaises(AssertionError):
|
||||
serializer = MyClassSerializer(
|
||||
MyClassSerializer(
|
||||
data=[{'value': 'set', 'id': instance.id} for instance in
|
||||
self.objs],
|
||||
instance=self.objs[:-1],
|
||||
many=True,
|
||||
partial=True,
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user