1👍
✅
Please check what are you returning from your view.
This might happen if your view is returning the form.as_p.
This can be corrected by returning the form only.
It should work! If it still doesnt work, post views and entire template.
0👍
If you know the name of the field, you can render it individually like that :
<div class="fieldWrapper">
{{ form.myfield.errors }}
<label for="{{ form.myfield.id_for_label }}">Label for myfield : </label>
{{ form.myfield }}
</div>
(you can also use {{ form.myfield.label_tag }} for the label if you defined it in the Form class)
Else, if you want to have a for you can do it like that :
{% for field in form %}
<div class="fieldWrapper">
{{ field.errors }}
{{ field.label_tag }} {{ field }}
</div>
{% endfor %}
It works well for me. If you still have a issue, it must be in the rest of your code I think. Show the enter template if so 🙂
- Count visitors on your site with django
- How can I calculate a date in a Django model?
- Add db_index = True to a Django model which already has a lot of data
Source:stackexchange.com