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 3324ed6 commit 665cf39Copy full SHA for 665cf39
1 file changed
rest_framework/fields.py
@@ -1754,7 +1754,14 @@ def get_value(self, dictionary):
1754
# We override the default field access in order to support
1755
# dictionaries in HTML forms.
1756
if html.is_html_input(dictionary):
1757
- return html.parse_html_dict(dictionary, prefix=self.field_name, default=empty)
+ result = html.parse_html_dict(dictionary, prefix=self.field_name, default=empty)
1758
+ if result is not empty:
1759
+ return result
1760
+ # If the field name itself is present in the input,
1761
+ # treat it as an explicit empty dict (e.g. clearing the field).
1762
+ if self.field_name in dictionary:
1763
+ return {}
1764
+ return empty
1765
return dictionary.get(self.field_name, empty)
1766
1767
def to_internal_value(self, data):
0 commit comments