Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)
Converts a QueryDict instance (i.e.request params) into a plain
dictionary

        def querydict_to_dict(querydict):
    """
    Converts a QueryDict instance (i.e.request params) into a plain
    dictionary
    """
    pure_dict = {}
    for item_key in querydict.keys():
        item_val_list = querydict.getlist(item_key)
        if item_val_list:
            if len(item_val_list) == 0:
                pure_dict[item_key] = None
            if len(item_val_list) == 1:
                pure_dict[item_key] = item_val_list[0]
            else:
                pure_dict[item_key] = item_val_list
        else:
            pure_dict[item_key] = None
    return pure_dict
        


src/i/x/IXDjango-0.1.4/ixdjango/test_suite/utils.py   IXDjango(Download)
from django.http import HttpRequest, QueryDict
 
from ixdjango.utils import (
    random_string,
    querydict_to_dict,