fix the message tags (== css classes) so they are meaningful to bootstrap3

note: tags can have multiple classes inside, so better use full class names
This commit is contained in:
Thomas Waldmann 2013-11-06 01:25:28 +01:00
parent e2f51d5eb1
commit e924b054fe
2 changed files with 10 additions and 1 deletions

View File

@ -357,6 +357,15 @@ SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True
# In this case foo field's value will be stored when user follows this link # In this case foo field's value will be stored when user follows this link
# <a href="{% url socialauth_begin 'github' %}?foo=bar">...</a>. # <a href="{% url socialauth_begin 'github' %}?foo=bar">...</a>.
# we need slightly different classes for bootstrap3 than the default ones
from django.contrib.messages import constants
MESSAGE_TAGS = {
constants.DEBUG: '',
constants.INFO: 'alert-info',
constants.SUCCESS: 'alert-success',
constants.WARNING: 'alert-warning',
constants.ERROR: 'alert-danger',
}
try: try:
from .local_settings import * from .local_settings import *

View File

@ -94,7 +94,7 @@
{% endif %} {% endif %}
{% if messages %} {% if messages %}
{% for message in messages %} {% for message in messages %}
<div class="alert alert-{{ message.tags }}"> <div class="alert {{ message.tags }}">
<button type="button" class="close" data-dismiss="alert">&times;</button> <button type="button" class="close" data-dismiss="alert">&times;</button>
{{ message }} {{ message }}
</div> </div>