Hiding ModelForm fields in a Django modelformset_factory
A small short and sweet one. I had trouble hiding a field in a Django modelformset_factory and none of the usual places were any help.
It turns out the simple answer is using the undocumented widgets parameter when creating it:
`A small short and sweet one. I had trouble hiding a field in a Django modelformset_factory and none of the usual places were any help.
It turns out the simple answer is using the undocumented widgets parameter when creating it:
`
This also means in a template it shows up as hidden, and isn’t included in the form.fields, but is included in form.hidden_fields – the more you know!