mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #26707 -- Added QueryDict.fromkeys()
This commit is contained in:
parent
da22079c21
commit
5ebebd1159
5 changed files with 64 additions and 2 deletions
|
@ -422,6 +422,16 @@ 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`.
|
||||
|
||||
.. classmethod:: QueryDict.fromkeys(iterable, value='', mutable=False, encoding=None)
|
||||
|
||||
.. versionadded:: 1.11
|
||||
|
||||
Creates a new ``QueryDict`` with keys from ``iterable`` and each value
|
||||
equal to ``value``. For example::
|
||||
|
||||
>>> QueryDict.fromkeys(['a', 'a', 'b'], value='val')
|
||||
<QueryDict: {'a': ['val', 'val'], 'b': ['val']}>
|
||||
|
||||
.. method:: QueryDict.__getitem__(key)
|
||||
|
||||
Returns the value for the given key. If the key has more than one value,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue