|
|
|
@ -281,30 +281,7 @@ def get_flashed_messages(with_categories=False, category_filter=[]):
|
|
|
|
|
* `category_filter` filters the messages down to only those matching the |
|
|
|
|
provided categories. |
|
|
|
|
|
|
|
|
|
Example usage: |
|
|
|
|
|
|
|
|
|
.. sourcecode:: html+jinja |
|
|
|
|
|
|
|
|
|
{% for category, msg in get_flashed_messages(with_categories=true) %} |
|
|
|
|
<p class=flash-{{ category }}>{{ msg }} |
|
|
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
|
Example usage similar to http://twitter.github.com/bootstrap/#alerts: |
|
|
|
|
|
|
|
|
|
.. sourcecode:: html+jinja |
|
|
|
|
|
|
|
|
|
{% 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 %} |
|
|
|
|
See :ref:`message-flashing-pattern` for examples. |
|
|
|
|
|
|
|
|
|
.. versionchanged:: 0.3 |
|
|
|
|
`with_categories` parameter added. |
|
|
|
|