We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dfe6628 commit e9ebed5Copy full SHA for e9ebed5
1 file changed
rest_framework/fields.py
@@ -1769,9 +1769,13 @@ def to_internal_value(self, data):
1769
Dicts of native values <- Dicts of primitive datatypes.
1770
"""
1771
if html.is_html_input(data):
1772
- data = html.parse_html_dict(data, default={}) or {
1773
- k: v for k, v in data.items()
1774
- }
+ # Coerce HTML form inputs (e.g. QueryDict/MultiValueDict) to a plain dict.
+ # Use `.dict()` when available to preserve existing behaviour of taking
+ # the first value for each key, otherwise fall back to `dict()`.
1775
+ if hasattr(data, 'dict'):
1776
+ data = data.dict()
1777
+ else:
1778
+ data = dict(data)
1779
if not isinstance(data, dict):
1780
self.fail('not_a_dict', input_type=type(data).__name__)
1781
if not self.allow_empty and len(data) == 0:
0 commit comments