class documentation

class QueryDict(MultiValueDict):

View In Hierarchy

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.
@classmethod
def fromkeys(cls, iterable, value='', mutable=False, encoding=None):
Return a new QueryDict with keys (may be repeated) from an iterable and values from value.
def __init__(self, query_string=None, mutable=False, encoding=None):
def __setitem__(self, key, value):
def appendlist(self, key, value):
Append an item to the internal list associated with key.
def copy(self):
Return a mutable copy of this object.
def pop(self, key, *args):

Undocumented

def popitem(self):

Undocumented

def setdefault(self, key, default=None):
def setlist(self, key, list_):
def setlistdefault(self, key, default_list=None):
def urlencode(self, safe=None):

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/'
def __copy__(self):
def __deepcopy__(self, memo):
def __delitem__(self, key):

Undocumented

def _assert_mutable(self):

Undocumented

def clear(self):

Undocumented

@encoding.setter
def encoding(self, value):

Undocumented

_encoding =

Undocumented

_mutable =

Undocumented

@property
encoding =

Undocumented