18👍
✅
You can update the form’s data
dict
self.data['fieldname'] = new_value
bound_data
is a method, not an attribute, so you can’t set the value there.
request.GET
and request.POST
are immutable, unless you create a copy()
. You could do the copy in your __init__
method, or before you bind the form.
data = request.POST.copy()
form = MyForm(data=data)
Source:stackexchange.com