{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, m in messages %}
    {% if category %}
        <div class="alert alert-{{ category }}">
    {% else %}
        <div class="alert alert-info">
    {% endif %}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
    {{ m }}
    </div>
{% endfor %}
{% endif %}
{% endwith %}
