Created
April 26, 2015 20:30
-
-
Save dimitrov/d099e927fc6276c9505e to your computer and use it in GitHub Desktop.
Bootstrap Alerts for Django
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
{% if messages %} | |
{% for message in messages %} | |
<div class="alert alert-{{ message.tags }} alert-dismissible text-center" role="alert"> | |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<strong>{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}Error{% else %}{{ message.tags|title }}{% endif %}!</strong> {{ message }} | |
</div> | |
{% endfor %} | |
{% endif %} |
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
from django.contrib.messages import constants as messages | |
MESSAGE_TAGS = { | |
messages.ERROR: 'danger' | |
} |
awesome
Very nice, thanks!
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
perfect sharing ... thanks