depot/web/quotes/quotesapp/middleware.py

16 lines
452 B
Python
Raw Normal View History

from django.contrib.auth.decorators import login_required
class LoginRequiredMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def is_open_url(self, path_info):
2021-01-20 22:20:07 +00:00
return path_info.startswith("/accounts/")
def __call__(self, request):
if not self.is_open_url(request.path_info):
return login_required()(self.get_response)(request)
return self.get_response(request)