def test2(n):
    for i in range(n):
        q = QueryDict('a=2&b=4&c=test')
z = QueryDict('').copy()
z.update(dict([x for x in list(q.items()) if x[0] != 'b']))
z.urlencode()
Django - Rebuild a query string without one of the variables