1👍
✅
You have
user = login(request, form)
login() requires a request and a user, not a form. You can get the user by calling authenticate before logging the user on. Try somnehting like:
def login_view(request):
if request.method == "POST":
print(f"{request.POST=}")
form = UserLoginForm(request.POST)
print(f"{form=}")
if form.is_valid():
print(" form valid")
#get cleaned form fields
email= form.cleaned_data['email']
password = form.cleaned_data['password']
#authenticate the user
user = authenticate(email=email, password=password)
login(request, user)
...
Another thing I find useful, especially if you are not using default auth forms, is making your ‘account’ app the first one listed in settings.py INSTALLED_APPS so it finds yours before the default ones, eg,
INSTALLED_APPS = [
"account",
"django.contrib.admin",
"django.contrib.auth",
...
Source:stackexchange.com