mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Fixed ListField getting value for POST request with content-type form-data. Returning val if val is empty.
This commit is contained in:
parent
939af5f4e3
commit
c3e89082f4
|
@ -1547,12 +1547,13 @@ class ListField(Field):
|
||||||
# We override the default field access in order to support
|
# We override the default field access in order to support
|
||||||
# lists in HTML forms.
|
# lists in HTML forms.
|
||||||
if html.is_html_input(dictionary):
|
if html.is_html_input(dictionary):
|
||||||
val = dictionary.getlist(self.field_name, [])
|
val = dictionary.getlist(self.field_name, empty)
|
||||||
|
if val == empty:
|
||||||
|
return val
|
||||||
if len(val) > 0:
|
if len(val) > 0:
|
||||||
# Support QueryDict lists in HTML input.
|
# Support QueryDict lists in HTML input.
|
||||||
return val
|
return val
|
||||||
parsed_list = html.parse_html_list(dictionary, prefix=self.field_name)
|
return html.parse_html_list(dictionary, prefix=self.field_name)
|
||||||
return parsed_list if parsed_list else empty
|
|
||||||
return dictionary.get(self.field_name, empty)
|
return dictionary.get(self.field_name, empty)
|
||||||
|
|
||||||
def to_internal_value(self, data):
|
def to_internal_value(self, data):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user