mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Merge d0ea6bfe02
into 8f6173cd8a
This commit is contained in:
commit
7cdf9fd422
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Helpers for dealing with HTML input.
|
Helpers for dealing with HTML input.
|
||||||
"""
|
"""
|
||||||
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
|
@ -50,6 +51,12 @@ def parse_html_list(dictionary, prefix=''):
|
||||||
for field, value in dictionary.items():
|
for field, value in dictionary.items():
|
||||||
match = regex.match(field)
|
match = regex.match(field)
|
||||||
if not match:
|
if not match:
|
||||||
|
try:
|
||||||
|
normalized_value = json.loads(value)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
if field == prefix and isinstance(normalized_value, list):
|
||||||
|
return normalized_value
|
||||||
continue
|
continue
|
||||||
index, key = match.groups()
|
index, key = match.groups()
|
||||||
index = int(index)
|
index = int(index)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user