When Django modifies the request attribute: this querydict instance is immutable

* * *

###Problem description

In many cases, if we want to modify the attribute value in the ‘request’ of the ‘Django’ project, an error will be reported to us:

“`
attributeerror: this querydict instance is immutable“`

That’s because in the official narration, the object is a non modifiable object. What should we do if we want to continue to try to modify the value in it

###Solutions

> This issue of push collates Python materials that beginners may use, including books/videos/online documents and editor/source
code. About the installation of ‘Python’, Qun: 850973621

“`
def medusa(request):
request.POST._ mutable = True

# or:
# request. Get_ Mutable = true
copy code
“`

At this point, when you need to modify the data value of the ‘request’ object, you can achieve the desired effect

Similar Posts: