diff options
| author | mark hellewell <mark.hellewell@icloud.com> | 2013-07-25 22:48:22 +1000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-07-25 11:06:41 -0400 |
| commit | 8c9240222fd882d9ae3819ff289989df1bcd05d7 (patch) | |
| tree | 19d78d3bc7d2382a840be733be47e4ef83410ab9 /docs | |
| parent | 92476e880caae75b1abad6ca50f821f9698c6c1e (diff) | |
Fixed #18315 -- Documented QueryDict.popitem and QueryDict.pop
Thanks gcbirzan for the report.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/request-response.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 060ec02e91..c57a1470d6 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -495,6 +495,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() Returns ``dict`` representation of ``QueryDict``. For every (key, list) |
