These formsets are exhibiting exactly the opposite behavior that I want.
My view is set up like this:
def post(request): # TODO: handle vehi
Oh I think I see. Try this:
from django.forms.formsets import BaseFormSet, formset_factory
class OneExtraRequiredFormSet(BaseFormSet):
def initial_form_count(self):
return max(super(OneExtraRequiredFormSet,self).initial_form_count() - 1,0)
VehicleFormSetFactory = formset_factory(VehicleForm, formset=OneExtraRequiredFormSet, extra=1)
== Original answer below ==
When you say "at least make one form required", I assume you mean "make only one extra form required, regardless of how many have been added via javascript".
You will need to have hidden input on your page which contains the number of forms that have been added via javascript, and then use that number, minus 1, as the value to pass in as the extra attribute to your formsets constructor.