diff --git a/django/forms/formsets.py b/django/forms/formsets.py index 383ad6f6af5..aca518b4d23 100644 --- a/django/forms/formsets.py +++ b/django/forms/formsets.py @@ -30,15 +30,13 @@ class ManagementForm(Form): new forms via JavaScript, you should increment the count field of this form as well. """ - def __init__(self, *args, **kwargs): - self.base_fields[TOTAL_FORM_COUNT] = IntegerField(widget=HiddenInput) - self.base_fields[INITIAL_FORM_COUNT] = IntegerField(widget=HiddenInput) - # MIN_NUM_FORM_COUNT and MAX_NUM_FORM_COUNT are output with the rest of - # the management form, but only for the convenience of client-side - # code. The POST value of them returned from the client is not checked. - self.base_fields[MIN_NUM_FORM_COUNT] = IntegerField(required=False, widget=HiddenInput) - self.base_fields[MAX_NUM_FORM_COUNT] = IntegerField(required=False, widget=HiddenInput) - super().__init__(*args, **kwargs) + TOTAL_FORMS = IntegerField(widget=HiddenInput) + INITIAL_FORMS = IntegerField(widget=HiddenInput) + # MIN_NUM_FORM_COUNT and MAX_NUM_FORM_COUNT are output with the rest of the + # management form, but only for the convenience of client-side code. The + # POST value of them returned from the client is not checked. + MIN_NUM_FORMS = IntegerField(required=False, widget=HiddenInput) + MAX_NUM_FORMS = IntegerField(required=False, widget=HiddenInput) def clean(self): cleaned_data = super().clean()