Regarding the immutable QueryDict error, your problem almost certainly is that you created your instance of the form as follows:
form = MyForm(request.POST)
This means that form.data is the actual QueryDict created from the POST rollers. Since the request itself is immutable, you receive an error message when you try to change anything in it. In this case, saying
form.data['field'] = None
is the same as
request.POST['field'] = None
To get a form that you can change, you want to build it like this:
form = MyForm(request.POST.copy())
Ian clelland
source share