{% if prefs_filter is defined and prefs_filter|length %} {% with messages = get_flashed_messages(with_categories=True, category_filter=prefs_filter) %} {% for category, message in messages %} {# Get the end of the of the category message which contains the category status.(success/error/notification)#} {% set category_status = category.split('-')|last %}
{% if category_status == "success" %} {% elif category_status == "error" %} {% elif category_status == "notification" %} {% endif %} {{ message }}
{% endfor %} {% endwith %} {% endif %}