[Answered ]-How to assign form id to Django ModelForm?

2👍

Django forms aren’t responsible for outputting the form element itself. So there is nothing to be done at the form declaration level.

You can always pass an attribute from the view and use it in your template:

<form id="{{ form_id_from_view }}" action="." method="POST">

0👍

You can directly assign the id to the form element in your template.

<form id="my_id" name="some_name" action="/my/url/" method="POST">

Leave a comment