diff options
| author | Tom Christie | 2014-11-06 17:32:33 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-11-06 17:32:33 +0000 |
| commit | db1dd8e2406bf54a82d154babd360fba52a0d4bc (patch) | |
| tree | b30e3f59c264b0ac5196fb8f824bd87ddf1f1e56 /rest_framework/utils | |
| parent | 4e001dbb7ac0bc13d6d5fbb4524e905184610aa2 (diff) | |
| download | django-rest-framework-db1dd8e2406bf54a82d154babd360fba52a0d4bc.tar.bz2 | |
Tests & fixes for list serialization
Diffstat (limited to 'rest_framework/utils')
| -rw-r--r-- | rest_framework/utils/html.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rest_framework/utils/html.py b/rest_framework/utils/html.py index edc591e9..15e83b3b 100644 --- a/rest_framework/utils/html.py +++ b/rest_framework/utils/html.py @@ -2,6 +2,7 @@ Helpers for dealing with HTML input. """ import re +from django.utils.datastructures import MultiValueDict def is_html_input(dictionary): @@ -43,7 +44,6 @@ def parse_html_list(dictionary, prefix=''): {'foo': 'hij', 'bar': 'klm'} ] """ - Dict = type(dictionary) ret = {} regex = re.compile(r'^%s\[([0-9]+)\](.*)$' % re.escape(prefix)) for field, value in dictionary.items(): @@ -57,7 +57,7 @@ def parse_html_list(dictionary, prefix=''): elif isinstance(ret.get(index), dict): ret[index][key] = value else: - ret[index] = Dict({key: value}) + ret[index] = MultiValueDict({key: [value]}) return [ret[item] for item in sorted(ret.keys())] |
