You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
611 B

from django.apps import AppConfig
from django.contrib.messages.storage import base
from django.contrib.messages.utils import get_level_tags
from django.core.signals import setting_changed
from django.utils.functional import SimpleLazyObject
from django.utils.translation import gettext_lazy as _
def update_level_tags(setting, **kwargs):
if setting == "MESSAGE_TAGS":
base.LEVEL_TAGS = SimpleLazyObject(get_level_tags)
class MessagesConfig(AppConfig):
name = "django.contrib.messages"
verbose_name = _("Messages")
def ready(self):
setting_changed.connect(update_level_tags)