0π
There are multiple places, where you have automatically generated forms or formsets, the most visible is admin and Generic Class Views.
Every time you are working with HTML forms do add or modify data β you should use forms.Form
. If you are working with the model β there is forms.ModelForm
which is build on top of the Form
β handling automatically declaration of fields, some validations and instance save. Then on top of this you have modelform_factory
β which is generating on-demand ModelForm
β so it is kind of shortcut to define default ModelForm
for your model.
Similar, modelformset_factory
is generating ModelFormSet
to be used with one-to-many relations.
1π
modelform_factory is a method to create forms in views , without defining form in forms.py file.
- How to get ID from another model in django?
- Get object with specific hour in django
- Get checkbox value in django