DictField returns empty value if no data was specified in a form request

This commit is contained in:
Brett Lempereur 2018-10-07 17:50:58 +01:00
parent 99fb424586
commit 0577a75d47

View File

@ -1711,7 +1711,7 @@ class DictField(Field):
# We override the default field access in order to support
# dictionaries in HTML forms.
if html.is_html_input(dictionary):
return html.parse_html_dict(dictionary, prefix=self.field_name)
return html.parse_html_dict(dictionary, prefix=self.field_name, default=empty)
return dictionary.get(self.field_name, empty)
def to_internal_value(self, data):