I want to check whether the message tag are INFO ?
How to check that in the template file?
I tried this but it didn't work:
{% if messages %}
<ul>
{% for message in messages %}
<li>
{% if message.tag == "INFO" %}
{{ message }}
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
I even tried other combinations like message.tag.info == "INFO"
etc but they didn't seem to work. What is the correct way of checking it?
Using bootstrap
{% block messages %}
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }}"> <!-- singular -->
<a class="close" data-dismiss="alert">×</a>
{{ message|safe }}
</div>
{% endfor %}
{% endif %}
{% endblock %}
So it's {{ message.tags }}
you're looking for
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