initial
This commit is contained in:
13
lib/messages.py
Normal file
13
lib/messages.py
Normal file
@@ -0,0 +1,13 @@
|
||||
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}'")
|
||||
Reference in New Issue
Block a user