class QueryDict(MultiValueDict):
A specialized MultiValueDict which represents a query string.
A QueryDict can be used to represent GET or POST data. It subclasses MultiValueDict since keys in such data can be repeated, for instance in the data from a form with a <select multiple> field.
By default QueryDicts are immutable, though the copy() method will always return a mutable copy.
Both keys and values set on this class are converted from the given encoding (DEFAULT_CHARSET by default) to str.
Class Method | fromkeys |
Return a new QueryDict with keys (may be repeated) from an iterable and values from value. |
Method | __init__ |
Undocumented |
Method | __setitem__ |
Undocumented |
Method | appendlist |
Append an item to the internal list associated with key. |
Method | copy |
Return a mutable copy of this object. |
Method | pop |
Undocumented |
Method | popitem |
Undocumented |
Method | setdefault |
Undocumented |
Method | setlist |
Undocumented |
Method | setlistdefault |
Undocumented |
Method | urlencode |
Return an encoded string of all query string arguments. |
Method | __copy__ |
Undocumented |
Method | __deepcopy__ |
Undocumented |
Method | __delitem__ |
Undocumented |
Method | _assert_mutable |
Undocumented |
Method | clear |
Undocumented |
Method | encoding.setter |
Undocumented |
Instance Variable | _encoding |
Undocumented |
Instance Variable | _mutable |
Undocumented |
Property | encoding |
Undocumented |
Inherited from MultiValueDict
:
Method | __getitem__ |
Return the last data value for this key, or [] if it's an empty list; raise KeyError if not found. |
Method | __getstate__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __setstate__ |
Undocumented |
Method | _getlist |
Return a list of values for the key. |
Method | dict |
Return current object as a dict with singular values. |
Method | get |
Return the last data value for the passed key. If key doesn't exist or value is an empty list, return default . |
Method | getlist |
Return the list of values for the key. If key doesn't exist, return a default value. |
Method | items |
Yield (key, value) pairs, where value is the last item in the list associated with the key. |
Method | lists |
Yield (key, list) pairs. |
Method | update |
Extend rather than replace existing key lists. |
Method | values |
Yield the last value on every key list. |
Return an encoded string of all query string arguments.
safe
specifies characters which don't require quoting, for example:
>>> q = QueryDict(mutable=True) >>> q['next'] = '/a&b/' >>> q.urlencode() 'next=%2Fa%26b%2F' >>> q.urlencode(safe='/') 'next=/a%26b/'