This commit is contained in:
Roland van Laar 2017-04-24 13:40:49 +00:00 committed by GitHub
commit 7cdf9fd422

View File

@ -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)