[Answered ]-Django modelformset_factory doesn't include actual forms

1👍

As described in the formset documention you must add the form tag manually. This is not very different from what you do when displaying a single form.

It appears that you are iterating through the formset and displayig them one by one. That means you must also add the management form

<form method="post" action="">
    {{ formset.management_form }}
    <div ='container'>
        {% for form in formset %}
            <div class='row'>{{form}} <input type="submit" value="Update" /></div>
        {% endfor %}
    <div>
</form>

Or you will get errors about a missing or misconfigured management form.

👤e4c5

1👍

Note that it does not include the tags, or a submit button. We’ll have to provide those ourselves in the template.

Read more: Working with Forms: Building a form in Django

The reason you are not getting the <form> tag is because from a logical point of view a form validation can be handled anywhere in your application. That’s why you need to specify the form tag explicitly with the target url (good to use reverse(view_name)), method and other parameters.

Leave a comment