mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Fix Issue #5301. Fix docs + allow None to be passed in to child + tests
This commit is contained in:
parent
edad462ca3
commit
f485099474
|
@ -1522,7 +1522,7 @@ class ListField(Field):
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
child = kwargs.pop('child')
|
child = kwargs.pop('child', None)
|
||||||
if child is None:
|
if child is None:
|
||||||
child = copy.deepcopy(self.child)
|
child = copy.deepcopy(self.child)
|
||||||
self.child = child
|
self.child = child
|
||||||
|
@ -1586,7 +1586,7 @@ class DictField(Field):
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
child = kwargs.pop('child')
|
child = kwargs.pop('child', None)
|
||||||
if child is None:
|
if child is None:
|
||||||
child = copy.deepcopy(self.child)
|
child = copy.deepcopy(self.child)
|
||||||
self.child = child
|
self.child = child
|
||||||
|
|
|
@ -1734,6 +1734,13 @@ class TestUnvalidatedListField(FieldValues):
|
||||||
field = serializers.ListField()
|
field = serializers.ListField()
|
||||||
|
|
||||||
|
|
||||||
|
class TestUnvalidatedListFieldWithChildNone(TestUnvalidatedListField):
|
||||||
|
"""
|
||||||
|
Values for `ListField` with `child=None`.
|
||||||
|
"""
|
||||||
|
field = serializers.ListField(child=None)
|
||||||
|
|
||||||
|
|
||||||
class TestDictField(FieldValues):
|
class TestDictField(FieldValues):
|
||||||
"""
|
"""
|
||||||
Values for `ListField` with CharField as child.
|
Values for `ListField` with CharField as child.
|
||||||
|
@ -1799,6 +1806,13 @@ class TestUnvalidatedDictField(FieldValues):
|
||||||
field = serializers.DictField()
|
field = serializers.DictField()
|
||||||
|
|
||||||
|
|
||||||
|
class TestUnvalidatedDictFieldWithChildNone(TestUnvalidatedDictField):
|
||||||
|
"""
|
||||||
|
Values for `ListField` with `child=None`.
|
||||||
|
"""
|
||||||
|
field = serializers.DictField(child=None)
|
||||||
|
|
||||||
|
|
||||||
class TestJSONField(FieldValues):
|
class TestJSONField(FieldValues):
|
||||||
"""
|
"""
|
||||||
Values for `JSONField`.
|
Values for `JSONField`.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user