Python Flask-Filter Flash Messages

Filter Flash Messages

Now you can pass a list of categories that filters the results of get_flashed_messages(). This is useful if you wish to render each category in a separate block.
{% with errors = get_flashed_messages(category_filter=["error"]) %}
{% if errors %}
<div class="alert-message block-message error">
  <a class="close" href="#">×</a>
  <ul>
    {%- for msg in errors %}
    <li>{{ msg }}</li>
    {% endfor -%}
  </ul>
</div>
{% endif %}
{% endwith %}