Files

14 lines
446 B
Python
Raw Permalink Normal View History

2025-08-27 09:55:55 +02:00
from django_middleware_global_request import get_request
from django.contrib import messages
import logging
def __getattr__(name):
def wrapper(*args, **kwargs):
request = get_request()
getattr(logging, name, logging.info)(*args)
return getattr(messages, name)(request, *args, **kwargs)
if hasattr(messages, name):
return wrapper
raise AttributeError(f"'{__name__}' object has no attribute '{name}'")