I have 2 models, Father and Son.
I have a page to register Father. On the same page I have a formset to register Son.
On page has a button “more” to add another Father and their respective Son on the same page.
Does anyone have any examples using CreateView?
Class based views are still new, so I’ll write this out. The process is simple:
First, create the forms for your objects. One of the forms will be repeated. Nothing special to be done here.
Then, create your
formset:Now, to integrate it with your
CreateView:Finally, here is the template:
The key part is the jquery django-dynamic-formset plugin that keeps adding new inline forms: