Created
October 22, 2020 13:38
-
-
Save Allwin12/10c838fdfa3c88f44ecd0940e0127566 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpResponse | |
from django.utils.deprecation import MiddlewareMixin | |
class ProcessRequestMiddleware(MiddlewareMixin): | |
def process_view(self, request, view_func, *view_args, **view_kwargs): | |
user = request.user | |
if user.is_authenticated: | |
return HttpResponse(status=200) | |
else: | |
return HttpResponse('Unauthorised', status=401) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment