Reputation: 3048
I am a bit confused. I know that by using Formset we could generate multiple form. Aside from that , when should I use Formset or Modelform?
Upvotes: 6
Views: 5156
Reputation: 8431
ModelForms are used to automatically create forms based on a single model instance.
If you don't have a model instance (and don't want to create one), but just want to handle arbitrary data, use a plain old form.
If you have lists of data that you need to get, whether as Models or data, FormSets are the answer.
FormSets are used to automatically manage lists of forms. You don't want to handle each form separately unless you need to. A FormSet can also use ModelForms, Yeah!
Upvotes: 18