AttributeError at /register/ 'User' object has no attribute 'is_authenticed --- when i check user is auth [closed]

i want create function when user is authenticed -- redirect to home but is not authenticed show page register

enter image description here

+++ in views

from django.shortcuts import render, redirect
from .models import customer
from .forms import customer_form
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import authenticate
from django.contrib.auth import login as login_auth
from django.contrib.auth import logout

from django.contrib.auth.decorators import login_required
def register(request):
    if request.user.is_authenticed():
        return redirect('/')
    else:
        form = UserCreationForm()
        if request.method == 'POST':
            form = UserCreationForm(request.POST)
            if form.is_valid():
                form.save()
    context = {'form' : form}
    return render(request, 'register.html', context)

+++ path

from django.urls import path
from . import views

path('register/', views.register, name="register"),

i want create function when user is authenticed -- redirect to home but is not authenticed show page register

Back to Top