multipart required False fixes to Serializer, ListSerialier, DictField, ListField

This commit is contained in:
Peter Coles 2015-04-05 17:02:41 -04:00
parent d53ff3f391
commit 0222241383
2 changed files with 4 additions and 4 deletions

View File

@ -1171,7 +1171,7 @@ class ListField(Field):
# We override the default field access in order to support
# lists in HTML forms.
if html.is_html_input(dictionary):
return html.parse_html_list(dictionary, prefix=self.field_name)
return html.parse_html_list(dictionary, prefix=self.field_name) or empty
return dictionary.get(self.field_name, empty)
def to_internal_value(self, data):
@ -1208,7 +1208,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) or empty
return dictionary.get(self.field_name, empty)
def to_internal_value(self, data):

View File

@ -351,7 +351,7 @@ class Serializer(BaseSerializer):
# We override the default field access in order to support
# nested 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) or empty
return dictionary.get(self.field_name, empty)
def run_validation(self, data=empty):
@ -502,7 +502,7 @@ class ListSerializer(BaseSerializer):
# We override the default field access in order to support
# lists in HTML forms.
if html.is_html_input(dictionary):
return html.parse_html_list(dictionary, prefix=self.field_name)
return html.parse_html_list(dictionary, prefix=self.field_name) or empty
return dictionary.get(self.field_name, empty)
def run_validation(self, data=empty):