how do I set the value of a field element after a form has been submitted but has failed validation? e.g.
if form.is_valid(): form.save() else: form.dat
I ended up doing
if request.method == 'POST': new_data = request.POST.copy() form = MyForm(data=new_data) if form.is_valid(): form.save() else: new_data['myField'] = 'some different data'
Hope this helps someone