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:
I managed with template tags only:
{% if messages %}
{% regroup messages by tags as messages %}
{% for tags in messages %}
{% endfor %}
{% endif %}
The key is the {% regroup %} tag.
This still has an some issues because the tags attribute includes the extra_tags of the message so if you make use of it you will get additional groups.
In future versions (probably 1.7), there will be a level_tag attribute so that issue will be gone soon.
(As soon as the level_tag attribute is available)
{% if messages %}
{% regroup messages by level_tag as messages %}
{% for level in messages %}
{% for message in level.list %}
- {{ message|capfirst }}
{% endfor %}
{% endfor %}
{% endif %}