From 730627f58100ec185bc1966efa33e321ec59bab8 Mon Sep 17 00:00:00 2001 From: Ahmed Ossama <58595131+AhmedOssama22dev@users.noreply.github.com> Date: Wed, 4 Aug 2021 01:55:12 +0200 Subject: [PATCH] fix list input bug --- rest_framework/utils/html.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rest_framework/utils/html.py b/rest_framework/utils/html.py index c7ede7803..ce1659f35 100644 --- a/rest_framework/utils/html.py +++ b/rest_framework/utils/html.py @@ -47,6 +47,11 @@ def parse_html_list(dictionary, prefix='', default=None): :returns a list of objects, or the value specified in ``default`` if the list is empty """ + if isinstance(dictionary, (list, tuple)): + dictionary = str(dictionary)[1:-1] + dictionary = '{' + dictionary[1:-1].replace('}', '').replace('{', '') + '}' + dictionary = eval(dictionary) + ret = {} regex = re.compile(r'^%s\[([0-9]+)\](.*)$' % re.escape(prefix)) for field, value in dictionary.items():