From a848923a394853e7ed30f14189703c4afaf0c772 Mon Sep 17 00:00:00 2001 From: Alen Mujezinovic Date: Thu, 9 Jun 2011 16:24:27 +0100 Subject: Returning the dict from `parse_qs` in `FormParser` fails on forms. Use `QueryDict` instead to return a value that is compatible with forms. --- djangorestframework/parsers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'djangorestframework/parsers.py') diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py index 726e09e9..4f49c20a 100644 --- a/djangorestframework/parsers.py +++ b/djangorestframework/parsers.py @@ -11,6 +11,7 @@ We need a method to be able to: and multipart/form-data. (eg also handle multipart/json) """ +from django.http import QueryDict from django.http.multipartparser import MultiPartParser as DjangoMultiPartParser from django.utils import simplejson as json from djangorestframework import status @@ -117,7 +118,7 @@ class FormParser(BaseParser): `data` will be a :class:`QueryDict` containing all the form parameters. `files` will always be :const:`None`. """ - data = parse_qs(stream.read(), keep_blank_values=True) + data = QueryDict(stream.read()) return (data, None) -- cgit v1.2.3 From d034c0fe4f1dbae77dccc9709335ad877700ed54 Mon Sep 17 00:00:00 2001 From: Alen Mujezinovic Date: Thu, 9 Jun 2011 16:27:45 +0100 Subject: Removed unused imports --- djangorestframework/parsers.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'djangorestframework/parsers.py') diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py index 4f49c20a..3346a26e 100644 --- a/djangorestframework/parsers.py +++ b/djangorestframework/parsers.py @@ -15,9 +15,7 @@ from django.http import QueryDict from django.http.multipartparser import MultiPartParser as DjangoMultiPartParser from django.utils import simplejson as json from djangorestframework import status -from djangorestframework.compat import parse_qs from djangorestframework.response import ErrorResponse -from djangorestframework.utils import as_tuple from djangorestframework.utils.mediatypes import media_type_matches __all__ = ( -- cgit v1.2.3