Skip to content

Instantly share code, notes, and snippets.

@DavidHickman
Created December 6, 2016 15:55
Show Gist options
  • Save DavidHickman/ca7589c72778958aed4273a64cc78510 to your computer and use it in GitHub Desktop.
Save DavidHickman/ca7589c72778958aed4273a64cc78510 to your computer and use it in GitHub Desktop.
Adding Bootstrap alerts as Flask flash messages
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class="flashes list-group">
{% for message in messages %}
<li class="list-group-item">
<div class="alert alert-success">{{message}}</div>
</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
.list-group {
margin: 10px 0;
}
.list-group-item {
margin: 0;
padding: 0;
}
.alert {
margin: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment