mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-08 06:14:47 +03:00
replace remaining references to old api
This commit is contained in:
parent
19fa92ebd3
commit
b209e35fd7
|
@ -1387,7 +1387,7 @@ class ListField(Field):
|
||||||
if len(val) > 1:
|
if len(val) > 1:
|
||||||
# Support QueryDict lists in HTML input.
|
# Support QueryDict lists in HTML input.
|
||||||
return val
|
return val
|
||||||
return html.parse_html_list(dictionary, prefix=self.field_name)
|
return html.parse_json_form(dictionary, prefix=self.field_name)
|
||||||
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):
|
||||||
|
@ -1395,7 +1395,7 @@ class ListField(Field):
|
||||||
List of dicts of native values <- List of dicts of primitive datatypes.
|
List of dicts of native values <- List of dicts of primitive datatypes.
|
||||||
"""
|
"""
|
||||||
if html.is_html_input(data):
|
if html.is_html_input(data):
|
||||||
data = html.parse_html_list(data)
|
data = html.parse_json_form(data)
|
||||||
if isinstance(data, type('')) or not hasattr(data, '__iter__'):
|
if isinstance(data, type('')) or not hasattr(data, '__iter__'):
|
||||||
self.fail('not_a_list', input_type=type(data).__name__)
|
self.fail('not_a_list', input_type=type(data).__name__)
|
||||||
if not self.allow_empty and len(data) == 0:
|
if not self.allow_empty and len(data) == 0:
|
||||||
|
@ -1426,7 +1426,7 @@ class DictField(Field):
|
||||||
# We override the default field access in order to support
|
# We override the default field access in order to support
|
||||||
# dictionaries in HTML forms.
|
# dictionaries in HTML forms.
|
||||||
if html.is_html_input(dictionary):
|
if html.is_html_input(dictionary):
|
||||||
return html.parse_html_dict(dictionary, prefix=self.field_name)
|
return html.parse_json_form(dictionary, prefix=self.field_name)
|
||||||
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):
|
||||||
|
@ -1434,7 +1434,7 @@ class DictField(Field):
|
||||||
Dicts of native values <- Dicts of primitive datatypes.
|
Dicts of native values <- Dicts of primitive datatypes.
|
||||||
"""
|
"""
|
||||||
if html.is_html_input(data):
|
if html.is_html_input(data):
|
||||||
data = html.parse_html_dict(data)
|
data = html.parse_json_form(data)
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
self.fail('not_a_dict', input_type=type(data).__name__)
|
self.fail('not_a_dict', input_type=type(data).__name__)
|
||||||
return dict([
|
return dict([
|
||||||
|
|
Loading…
Reference in New Issue
Block a user