Created
December 26, 2018 17:32
-
-
Save gilsonbp/559f5a0b24743bad020b2bc80e04c889 to your computer and use it in GitHub Desktop.
Middleware que faz um teste específico então redireciona para uma rota
This file contains hidden or 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.shortcuts import redirect | |
class RedirectHome(object): | |
def __init__(self, get_response): | |
self.get_response = get_response | |
def __call__(self, request): | |
if True: # Faz o teste ante de redirecionar | |
return redirect('site:home') | |
response = self.get_response(request) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment