Django- login_required decorter не работает помогите пожалуйста

Работаю над простым проектом с использованием Django и декоратор loqin_required не работает. Я просто хочу, чтобы когда пользователь вошел в систему и обновил страницу или нажал "назад", он должен выйти из системы. Вот мой код :

views.py

from django.shortcuts import render
from django.contrib.auth.decorators import login_required

# Create your views here.

@login_required(login_url='/authentication/login')
def index(request):
    return render(request,'expenses/index.html')
def add_expense(request):
    return render(request,'expenses/add_expense.html')

urls.py

    from .views import RegistrationView,UsernameValidationView,EmailValidationView, VerificationView, LoginView ,LogoutView
from django.urls import path
from django.views.decorators.csrf import csrf_exempt

urlpatterns = [
    path('register',RegistrationView.as_view(),name="register"),
    path('login',LoginView.as_view(),name="login"),
    path('logout',LogoutView.as_view(),name="logout"),
    path('validate-username',csrf_exempt(UsernameValidationView.as_view()),
        name="validate-username"),
    path('validate-email', csrf_exempt(EmailValidationView.as_view()),
        name='validate_email'),
    path('activate/<uidb64>/<token>',VerificationView.as_view(),name="activate"),
Вернуться на верх