summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-06-16 16:34:55 +0000
committerJannis Leidel <jannis@leidel.info>2011-06-16 16:34:55 +0000
commit97f22f29699476d5bcbbf599a3dba22909f4ec85 (patch)
treefcdef059c7c18978bd2e1a4873b1c1c57ff8ec72 /docs
parentdfa29161e2eff676eb4aa187f76c157556dfc5db (diff)
Fixed #12375 -- Added a dict() method to convert a MultiValueDict (such as a QueryDict) to a dictionary of key-value pairs. Thanks, oinopion and hvdklauw.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16418 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/request-response.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index ff04e25b1d..295fba176f 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -482,6 +482,18 @@ In addition, ``QueryDict`` has the following methods:
>>> q.lists()
[(u'a', [u'1', u'2', u'3'])]
+.. method:: QueryDict.dict()
+
+ .. versionadded:: 1.4
+
+ Returns ``dict`` representation of ``QueryDict``. For every (key, list)
+ pair in ``QueryDict``, ``dict`` will have (key, item), where item is one
+ element of the list, using same logic as :meth:`QueryDict.__getitem__()`::
+
+ >>> q = QueryDict('a=1&a=3&a=5')
+ >>> q.dict()
+ {u'a': u'5'}
+
.. method:: QueryDict.urlencode([safe])
Returns a string of the data in query-string format. Example::