[Django]-Applying bootsrap and custom css to {{form}} elements in django

2👍

<div class="form-group">
{% for field in form %}
  <label for="id_Fullname" id="{{ field.name }}">Full Name:</label>
  {{ field }}
{% endfor %}
</div>

try this

1👍

You can use the id_for_label property of field:

Use this property to render the ID of this field. For example, if you are manually constructing a <label> in your template.

<div class="form-group">
  <label for="{{ form.Fullname.id_for_label }}">Full Name:</label>
  {{ form.Fullname }}
</div>
👤Selcuk

0👍

This was an error of placing the def init function inside Class Meta: instead of Class ContactInfo. I had not realized I had indented it improperly.

Leave a comment