mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 22:04:48 +03:00
multipart required False fixes to Serializer, ListSerialier, DictField, ListField
This commit is contained in:
parent
d53ff3f391
commit
0222241383
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user