[Fixed]-Trying to understand FormSet ManagementForm data (because error = "it's missing")

1👍

Firstly, you must include the management form inside the form tag your template if you are using a formset.

{{ survey_formset.management_form }}

Next, if you add forms to the formset or remove them, then you need to increment/decrement the value of the management form’s form-TOTAL_FORMS input. The django-dynamic-formset jQuery plugin takes care of doing this for you. If you don’t use it, then you’ll have to do this yourself.

Finally, this line does not make sense.

survey_formset = SurveyFormSet(request.POST, data)

The fields from the form data should be in request.POST, you can’t add additional data with the second argument like that.

Leave a comment