You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
1 year ago
|
from django.utils.deprecation import MiddlewareMixin
|
||
|
from django.http import HttpResponse
|
||
|
|
||
|
|
||
|
class AuthMiddleWare1(MiddlewareMixin):
|
||
|
def process_request(self, request):
|
||
|
print('process_request-1')
|
||
|
|
||
|
def process_view(self, request, callback, callback_args, callback_kwargs):
|
||
|
print('process_view-1')
|
||
|
|
||
|
def process_template_response(self, request, response):
|
||
|
print('process_template_response -1')
|
||
|
return response
|
||
|
|
||
|
def process_exception(self, request, exception):
|
||
|
print('process_exception-1')
|
||
|
|
||
|
def process_response(self, request, response):
|
||
|
print('prcoess_response-1')
|
||
|
return response
|
||
|
|
||
|
|
||
|
class AuthMiddleWare2(MiddlewareMixin):
|
||
|
def process_request(self, request):
|
||
|
print('process_request-2')
|
||
|
|
||
|
def process_view(self, request, callback, callback_args, callback_kwargs):
|
||
|
print('process_view-2')
|
||
|
|
||
|
def process_template_response(self, request, response):
|
||
|
print('process_template_response -2')
|
||
|
return response
|
||
|
|
||
|
def process_exception(self, request, exception):
|
||
|
print('process_exception-2')
|
||
|
|
||
|
def process_response(self, request, response):
|
||
|
print('prcoess_response-2')
|
||
|
return response
|