You are correct in that a formset is the way you want to do this.
Be aware that if you dynamically add an instance of a form to a formset, you need to ensure that the id
and name
attributes of the form elements are created correctly and that you adjust the management form as well.
You can search this forum for other threads on this topic to find some examples and other discussions about this.
I’d also suggest reading:
and