title: how to access django form field name in template
body: <p>I've got a modelform that I would like to iterate through the form fields in the template but at the same time, when I encounter certain fields, to conditionally render extra html. Currently I am pulling the field name from <code>field.html_name</code> but I am not sure if that is the best way (it feels hackish somehow, like I should be using a <code>getattr()</code> filter or something...).</p>
  
  <pre><code>{% for field in form %}
  &lt;div class="form-group"&gt;
  
      {{ field }}
  
      {% if field.html_name == "location" %}
        &lt;!-- CUSTOM HTML HERE --&gt;
      {% endif %}
  
  &lt;/div&gt;   
  {% endfor %}
  </code></pre>