re: Django inline formsets with Class-based views and crispy forms VIEW POST

FULL DISCUSSION
 

Thank you so much for this tut. How can i limit the number of forms in the form set that can be added?

 

Thanks!
When you create you inline formset you can limit the number of forms in the formset with max_num parameter

e.g.

CollectionTitleFormSet = inlineformset_factory(
    Collection, CollectionTitle, form=CollectionTitleForm,
    fields=['name', 'language'], extra=1, max_num=3, can_delete=True
    )
code of conduct - report abuse