diff options
| author | José Padilla | 2014-11-28 12:14:40 -0400 |
|---|---|---|
| committer | José Padilla | 2014-11-28 12:14:40 -0400 |
| commit | 0cc990792c63caa8fa8fea62cea53b0d28157b55 (patch) | |
| tree | 7ea80a203cc8718150cd55e4403f3f4771160281 /rest_framework/utils/html.py | |
| parent | 1aa77830955dcdf829f65a9001b6b8900dfc8755 (diff) | |
| parent | 3a5b3772fefc3c2f2c0899947cbc07bfe6e6b5d2 (diff) | |
| download | django-rest-framework-0cc990792c63caa8fa8fea62cea53b0d28157b55.tar.bz2 | |
Merge branch 'version-3.1' into oauth_as_package
Conflicts:
requirements-test.txt
rest_framework/compat.py
tests/settings.py
tox.ini
Diffstat (limited to 'rest_framework/utils/html.py')
| -rw-r--r-- | rest_framework/utils/html.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rest_framework/utils/html.py b/rest_framework/utils/html.py index edc591e9..d773952d 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): @@ -35,7 +36,7 @@ def parse_html_list(dictionary, prefix=''): '[0]foo': 'abc', '[0]bar': 'def', '[1]foo': 'hij', - '[2]bar': 'klm', + '[1]bar': 'klm', } --> [ @@ -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())] @@ -72,7 +72,7 @@ def parse_html_dict(dictionary, prefix): --> { 'profile': { - 'username': 'example, + 'username': 'example', 'email': 'example@example.com' } } |
