mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-01 19:10:12 +03:00
Remove condition that cleans values from DictField improperly
This commit is contained in:
parent
9b7db8dd69
commit
5aee660804
|
@ -1718,8 +1718,6 @@ class DictField(Field):
|
||||||
"""
|
"""
|
||||||
Dicts of native values <- Dicts of primitive datatypes.
|
Dicts of native values <- Dicts of primitive datatypes.
|
||||||
"""
|
"""
|
||||||
if html.is_html_input(data):
|
|
||||||
data = html.parse_html_dict(data)
|
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
self.fail('not_a_dict', input_type=type(data).__name__)
|
self.fail('not_a_dict', input_type=type(data).__name__)
|
||||||
return self.run_child_validation(data)
|
return self.run_child_validation(data)
|
||||||
|
|
|
@ -1997,6 +1997,17 @@ class TestDictField(FieldValues):
|
||||||
output = field.run_validation(None)
|
output = field.run_validation(None)
|
||||||
assert output is None
|
assert output is None
|
||||||
|
|
||||||
|
def test_html_input_as_dict(self):
|
||||||
|
"""
|
||||||
|
HTML inputs should be converted to dict
|
||||||
|
"""
|
||||||
|
class TestSerializer(serializers.Serializer):
|
||||||
|
properties = serializers.DictField()
|
||||||
|
|
||||||
|
serializer = TestSerializer(data=QueryDict('properties.key1=value1&properties.key2=value2'))
|
||||||
|
assert serializer.is_valid()
|
||||||
|
assert serializer.validated_data == {'properties': {'key1': 'value1', 'key2': 'value2'}}
|
||||||
|
|
||||||
|
|
||||||
class TestNestedDictField(FieldValues):
|
class TestNestedDictField(FieldValues):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user