Skip to content

Instantly share code, notes, and snippets.

@AliYmn
Created February 12, 2017 17:40
Show Gist options
  • Save AliYmn/4b55fb262b450ae1a75b471ac051db9a to your computer and use it in GitHub Desktop.
Save AliYmn/4b55fb262b450ae1a75b471ac051db9a to your computer and use it in GitHub Desktop.
from django.http import HttpResponse
from django.utils.deprecation import MiddlewareMixin
class SimpleMiddleware(MiddlewareMixin):
def process_request(self, request):
pass
def process_response(self, request, response):
if(not request.path == "/"):
return HttpResponse("User : {}".format(request.user))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment