How to Format/Overwrite Django Form Error Message?

django, forms, html, python

Solution

You could either just remove the tags:

{{ form.no.errors|striptags }}

Or just access the raw error:

{{ form.no.errors.as_text }}

Problem

forms.py ``` class MyForm(forms.Form): no = forms.CharField(error_messages={'required': u'must be xxx') ``` template.html ``` {{form.no.error}} ``` `{{form.no.error}}` is `<ul class="errorlist"><li>must be xxx</li></ul>` I want to format `{{form.no.error}}` to plain text message without any html tags

Original source