Displaying Django Messages Framework Messages
Posted
by Arif
on Stack Overflow
See other posts from Stack Overflow
or by Arif
Published on 2010-04-23T09:37:51Z
Indexed on
2010/04/23
9:43 UTC
Read the original article
Hit count: 509
django
|django-templates
I have been using the Django Messaging Framework to display messages to a user in the template.
I am outputting them to the template like this:
<ul>
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
This outputs all the messages, errors, warning, success etc. I was just wondering if anyone had any ideas how to display only the error messages something like:
<ul>
{% for message in messages.errors %}
<li>{{ message }}</li>
{% endfor %}
</ul>
Any ideas? Thanks in advance.
© Stack Overflow or respective owner