summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDuncan Parkes <duncan@mysociety.org>2014-06-24 22:01:39 -0400
committerTim Graham <timograham@gmail.com>2014-06-24 22:02:03 -0400
commitd68987ae25f0e0fb30727473803758af53d75671 (patch)
tree931928054dab11e18e9e57333fca1b1830134854 /docs
parent7f4e2ef1e9e9f5c86217ccf9ac97391291a9d422 (diff)
Fixed #22897 -- Made QueryDict query_string argument optional.
Now QueryDict() is equivalent to QueryDict('') or QueryDict(None).
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/request-response.txt11
-rw-r--r--docs/releases/1.8.txt5
2 files changed, 14 insertions, 2 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index bc2eee5a3f..2bd246e6b6 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -355,13 +355,16 @@ Methods
:class:`QueryDict` implements all the standard dictionary methods because it's
a subclass of dictionary. Exceptions are outlined here:
-.. method:: QueryDict.__init__(query_string, mutable=False, encoding=None)
+.. method:: QueryDict.__init__(query_string=None, mutable=False, encoding=None)
Instantiates a ``QueryDict`` object based on ``query_string``.
>>> QueryDict('a=1&a=2&c=3')
<QueryDict: {u'a': [u'1', u'2'], u'b': [u'1']}>
+ If ``query_string`` is not passed in, the resulting ``QueryDict`` will be
+ empty (it will have no keys or values).
+
Most ``QueryDict``\ s you encounter, and in particular those at
``request.POST`` and ``request.GET``, will be immutable. If you are
instantiating one yourself, you can make it mutable by passing
@@ -370,6 +373,10 @@ a subclass of dictionary. Exceptions are outlined here:
Strings for setting both keys and values will be converted from ``encoding``
to unicode. If encoding is not set, it defaults to :setting:`DEFAULT_CHARSET`.
+ .. versionchanged:: 1.8
+
+ In previous versions, ``query_string`` was a required positional argument.
+
.. method:: QueryDict.__getitem__(key)
Returns the value for the given key. If the key has more than one value,
@@ -523,7 +530,7 @@ In addition, ``QueryDict`` has the following methods:
Optionally, urlencode can be passed characters which
do not require encoding. For example::
- >>> q = QueryDict('', mutable=True)
+ >>> q = QueryDict(mutable=True)
>>> q['next'] = '/a&b/'
>>> q.urlencode(safe='/')
'next=/a%26b/'
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 3fd8b64e93..11b051fc70 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -215,6 +215,11 @@ Requests and Responses
:exc:`~django.core.exceptions.SuspiciousOperation`, the response will be
rendered with a detailed error page.
+* The ``query_string`` argument of :class:`~django.http.QueryDict` is now
+ optional, defaulting to ``None``, so a blank ``QueryDict`` can now be
+ instantiated with ``QueryDict()`` instead of ``QueryDict(None)`` or
+ ``QueryDict('')``.
+
Tests
^^^^^