django-test/env/lib/python3.8/site-packages/django/contrib/messages/apps.py

19 lines
542 B
Python
Raw Normal View History

2022-08-26 10:41:18 +00:00
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.translation import gettext_lazy as _
def update_level_tags(setting, **kwargs):
if setting == "MESSAGE_TAGS":
base.LEVEL_TAGS = get_level_tags()
class MessagesConfig(AppConfig):
name = "django.contrib.messages"
verbose_name = _("Messages")
def ready(self):
setting_changed.connect(update_level_tags)