i want to call custom decorator only once per session
def cust_decorator(function):
def wrapper(request,*args, **kwargs):
........
.......
wrapper.__doc__ = function.__doc__
wrapper.__name__ = function.__name__
return wrapper
i want to call cust_decorator decorator only once per session for a particular user
You could set a session variable when the decorator has been called for the first time and check for this value to determine if the alert should be shown again. Another way could be to write your own middleware.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.