Alternatily to CSS, you can iterate over errors like:
{% for field, error in form.errors.items %}
{% if field != '__all__' %}{{ field }}{% endif %}
{{ error | striptags }}
{% endfor %}
Question
Okay so I have a form and then I want to print the errors, if any, when the user submits in the form. So in my template, I have the code
{% if form.errors %}
{{ form.errors }}
{% endif %}
Now, the problem is, suppose the user forgets to put in the username, django will display this error message.
username
- This field is required.
Except the "-" is a bullet.. How do I remove the bullet point and just make it inline with username? I tried to use CSS and make the display inline but that didn't work.
Solution 2
Alternatily to CSS, you can iterate over errors like:
{% for field, error in form.errors.items %}
{% if field != '__all__' %}{{ field }}{% endif %}
{{ error | striptags }}
{% endfor %}
OTHER TIPS
This isn't really a django question, it's css. But in any case, you need to apply list-style: none
to the error list, ie.
.errorlist {
list-style: none;
}