<commit_before>from django import template
from django.contrib.messages.utils import get_level_tags


LEVEL_TAGS = get_level_tags()

register = template.Library()


@register.simple_tag()
def get_message_tags(message):
    """
    Returns tags for a message
    """
    level_name = LEVEL_TAGS[message.level]
    if level_name == u"error":
        level_name = u"danger"

    level_tag = u"alert-{name}".format(name=level_name)

    tags = [level_tag]
    if message.extra_tags:
        tags.append(message.extra_tags)

    return u" ".join(tags)<commit_msg>Use level_tag to be consistent with Django >= 1.7<commit_after>from django import template
from django.contrib.messages.utils import get_level_tags


LEVEL_TAGS = get_level_tags()

register = template.Library()


@register.simple_tag()
def get_message_tags(message):
    """
    Returns the message's level_tag prefixed with Bootstrap's "alert-" prefix
    along with any tags included in message.extra_tags

    Messages in Django >= 1.7 have a message.level_tag attr
    """
    level_tag = LEVEL_TAGS[message.level]
    if level_tag == u"error":
        level_tag = u"danger"

    alert_level_tag = u"alert-{tag}".format(tag=level_tag)

    tags = [alert_level_tag]
    if message.extra_tags:
        tags.append(message.extra_tags)

    return u" ".join(tags)
{'fraction_non_alphanumeric': 0.10370931112793338, 'fraction_numerical': 0.003028009084027252, 'mean_word_length': 3.7725631768953067, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6345540', 'n_tokens_mistral': 440, 'n_tokens_neox': 414, 'n_words': 99}