How do I format django form.non_field_errors.as_text in a template without them being either an unordered list or having an *
appended to the front?
{{ form.non_field_errors.as_text }}
displays the errors with an *
in front of the text.
This django ticket was also helpful in explaining why the *
will not be removed, but that doesn't help me. I do not want the *
.
Both {{ form.non_field_errors }} and {{ form.non_field_errors.as_ul }} display as an unordered list, and I do not want an unordered list.
{% for error in form.non_field_errors %}
{{error}}
{% endfor %}
When you call the list of errors as text it will try to display it as a list. Simply loop through the list to get the error by itself so you can apply your own styling.
More info about it on the django project website
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With