I am trying to set the field to a certain value after the form is initialized.
For example, I have the following class.
class CustomForm(forms.Form)
To throw yet another way into the mix: this works too, with a bit more modern notation. It just works around the fact that a QueryDict is immutable.
QueryDict
>>> the_form.data = {**f.data.dict(), 'some_field': 47} >>> the_form['some_field'].as_widget() ''