I am making a form to add many products to the same collection and I want the create collection form to create the collection with an unlimited list of products.
My form is this:
class TendenciaForm(forms.ModelForm):
class Meta:
model = Tendencia
fields = ['nombre']
producto = forms.ModelChoiceField(
queryset=Marca.objects.all(),
widget=autocomplete.ModelSelect2(url='producto-autocomplete')
)
I know that formsets exist but they are limited to a quantity and I want them to be able to send all the products they need at once.
You can find a lot of information in an article by Jacob Kaplan-Moss you will find step by step and a clear example: dinamic forms