@@ 160,16 160,16 @@ LOG_IPS_ANONYMOUS = getattr(django_settings, 'WIKI_LOG_IPS_ANONYMOUS', True)
#: Do we want to log IPs of logged in users?
LOG_IPS_USERS = getattr(django_settings, 'WIKI_LOG_IPS_USERS', False)
-#: Mapping from message.tag to bootstrap class names.
+#: Mapping from message.level to bootstrap class names.
MESSAGE_TAG_CSS_CLASS = getattr(
django_settings,
'WIKI_MESSAGE_TAG_CSS_CLASS',
{
- messages.DEFAULT_TAGS[messages.DEBUG]: "alert alert-info",
- messages.DEFAULT_TAGS[messages.ERROR]: "alert alert-danger",
- messages.DEFAULT_TAGS[messages.INFO]: "alert alert-info",
- messages.DEFAULT_TAGS[messages.SUCCESS]: "alert alert-success",
- messages.DEFAULT_TAGS[messages.WARNING]: "alert alert-warning",
+ messages.DEBUG: "alert alert-info",
+ messages.ERROR: "alert alert-danger",
+ messages.INFO: "alert alert-info",
+ messages.SUCCESS: "alert alert-success",
+ messages.WARNING: "alert alert-warning",
}
)
@@ 80,11 80,7 @@ def wiki_messages(context):
messages = context.get('messages', [])
for message in messages:
- message.css_class = ""
- for tag in message.tags.split(" "):
- # Drop KeyError if MESSAGE_TAG_CSS_CLASS doesn't have the tag,
- # that seems valuable.
- message.css_class += " " + settings.MESSAGE_TAG_CSS_CLASS[tag]
+ message.css_class = settings.MESSAGE_TAG_CSS_CLASS[message.level]
context.update({
'messages': messages
})