Last active
July 3, 2018 15:58
-
-
Save allanaguilar/fda704bd180ecf2cca51de607b41af69 to your computer and use it in GitHub Desktop.
Flask flash messages as Bootstrap alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% with messages = get_flashed_messages(with_categories=true) %} | |
<!-- Categories: success (green), info (blue), warning (yellow), danger (red) --> | |
{% if messages %} | |
{% for category, message in messages %} | |
<div class="alert alert-{{ category }} alert-dismissible" role="alert"> | |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<!-- <strong>Title</strong> --> {{ message }} | |
</div> | |
{% endfor %} | |
{% endif %} | |
{% endwith %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reference:
https://coderwall.com/p/ijrrpa/flask-flash-messages-as-bootstrap-alert
by Victor Kristof