Formsets inside forms
Or maybe you will find other use cases for it :)
Install django-formsetfield with pip:
$ pip install django-formsetfield
Add formsetfield to INSTALLED_APPS.
from django import forms from formsetfield.fields import FormSetField class AdultForm(forms.Form): fullname = forms.CharField() passport = forms.CharField() class ChildForm(forms.Form): fullname = forms.CharField() birth_certificate = forms.CharField() class PassengersForm(forms.Form): adults = FormSetField(formset_factory(AdultForm)) children = FormSetField(formset_factory(ChildForm))
Feel free to fork, send pull requests or report bugs and issues on github.