title: Django Forms Set Name Of The Form
body: <p>How can I set the <strong>name of the form</strong> with model form ?</p>
  
  <p>This is my model form :</p>
  
  <pre><code>class DetayModelForm(forms.ModelForm):
    class Meta:
      model = Detay
      fields = [ 'yazi', 'tip', 'kullanimAdet']
  </code></pre>
  
  <p>I know how to set name attribute of a <strong>field</strong> in a form, <em>there are a lot of examples also</em>.</p>
  
  <p>But I really really couldn't find that how can I set the form's own name , <strong>not a field in the form</strong>, exactly form's own name attribute; in the ModelForm class.</p>
  
  <p>In html side , I will use this attribute : <a href="https://www.w3schools.com/tags/att_form_name.asp" rel="nofollow noreferrer">https://www.w3schools.com/tags/att_form_name.asp</a></p>
  
  <p>I need to use html form <strong>name</strong> attribute in my template but, I couldn't find how to add this attribute to the form directly in ModelForm class.</p>
  
  <p>I tried to use init in ModelForm class like that :</p>
  
  <pre><code>def __init__(self, *args, **kwargs):
      super().__init__(*args, **kwargs)
      self.name = 'DetayFormu'
  </code></pre>
  
  <p>But in html side, still form doesn't have a name attribute.</p>
  
  <p>And also I know , yes I can set this attribute in my template like that :</p>
  
  <pre><code>&lt;form method="post" name="DetayFormu"&gt;
    {% csrf_token %}
    {{ form|crispy }}
    &lt;button type="submit" class="btn btn-primary"&gt;Sign in&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <blockquote>
    <p>But I really wonder how can I set this attribute <strong>in ModelForm class
    directly</strong>.</p>
  </blockquote>
  
  <p>How can I do this ?</p>