Last active
June 3, 2020 17:24
-
-
Save walison17/6094c6fccfe9d97e8705f10166bc1496 to your computer and use it in GitHub Desktop.
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 functools import wraps | |
from django.shortcuts import redirect | |
def verificar_funcionario(redirect_to='set_password'): | |
def decorator(view_func): | |
@wraps(view_func) | |
def _wrapped_view(request, *args, **kwargs): | |
if request.user.funcionario.mudou_senha_padrao: | |
return view_func(request, *args, **kwargs) | |
return redirect(redirect_to) | |
return _wrapped_view | |
return decorator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment