{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category}}" alert-dismissible fade in">
<button aria-label="Close" data-dismiss="alert" class="close" type="button"><span aria-hidden="true">×</span></button>
<p>{{ message|custom_safe }}</p>
</div>
{% endfor %}
{% endif %}
{% endwith %}