summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authormark hellewell <mark.hellewell@icloud.com>2013-07-25 22:48:22 +1000
committerTim Graham <timograham@gmail.com>2013-07-25 11:09:19 -0400
commitfdef471912022dd5d65946fa6f86adbc3c60f630 (patch)
tree3bf8284d79e3b8296b3fba66d2e02a654f6cf7ed /docs/ref
parentbe6d795854b5b3c50d3370720b8eb3861d5ff32f (diff)
[1.5.x] Fixed #18315 -- Documented QueryDict.popitem and QueryDict.pop
Thanks gcbirzan for the report. Backport of 8c9240222f from master
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/request-response.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index 26681e575e..da02fb7a68 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -504,6 +504,26 @@ In addition, ``QueryDict`` has the following methods:
>>> q.lists()
[(u'a', [u'1', u'2', u'3'])]
+.. method:: QueryDict.pop(key)
+
+ Returns a list of values for the given key and removes them from the
+ dictionary. Raises ``KeyError`` if the key does not exist. For example::
+
+ >>> q = QueryDict('a=1&a=2&a=3', mutable=True)
+ >>> q.pop('a')
+ [u'1', u'2', u'3']
+
+.. method:: QueryDict.popitem()
+
+ Removes an arbitrary member of the dictionary (since there's no concept
+ of ordering), and returns a two value tuple containing the key and a list
+ of all values for the key. Raises ``KeyError`` when called on an empty
+ dictionary. For example::
+
+ >>> q = QueryDict('a=1&a=2&a=3', mutable=True)
+ >>> q.popitem()
+ (u'a', [u'1', u'2', u'3'])
+
.. method:: QueryDict.dict()
.. versionadded:: 1.4