Problem description

Most of the time when we want to change the value of a Django request property, we get an error:

AttributeError: This QueryDict instance is immutable
Copy the code

That’s because in the official narrative, this object is an immutable object, so what if we want to keep trying to change the value?

The solution

def medusa(request) :
    request.POST._mutable = True
    
    # or:
    # request.GET._mutable = True
Copy the code

When you need to modify the data value of the request object, you can achieve the desired effect.