mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
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
This commit is contained in:
parent
dfa29161e2
commit
97f22f2969
3 changed files with 30 additions and 0 deletions
|
@ -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::
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue