1from django.contrib.auth import logout
2
3def logout_view(request):
4 logout(request)
5 # Redirect to a success page.
6
1from django.contrib.auth.mixins import LoginRequiredMixin
2
3class MyView(LoginRequiredMixin, View):
4 login_url = '/login/'
5 redirect_field_name = 'redirect_to'
6