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:
you can use following to check message tags.
{% if message.tags == "error" %} your code here {% endif %}