from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.views.generic import RedirectView
# 301 - permanente (browser salva como cache destino)
# 302 - temporário
class LogoutRedirectView(RedirectView):
url = '/login/'
@method_decorator(login_required(login_url='/login/'))
def get(self, request, *args, **kwargs):
django_logout(request)
return super().get(request, *args, **kwargs)
Created
April 2, 2019 04:01
-
-
Save richellyitalo/259eb23272d4c314021578dff8189355 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment