problems with auth.login

i am building a custom login app with django and postgres, i wrote a login_view when django tries to login in to da db it crash :

def logins(request):
if request.method == ‘POST’:
info = UserInfo()
username = request.POST[‘username’]
password = request.POST[‘password’]
user = auth.authenticate(username=username, password=password)
if user is not None:
info.user_name = username
auth.login(request, user) # i get blocked here
if request.user.is_superuser:
info.user_role = True
return render(request, “dashboard.html”, {‘info’: info})
return render(request, “dashboard.html”, {‘info’: info})
return redirect(’/’)
return redirect(’/’)

but when i write into the search bar of the browser : , it take me to the default dashboard admin of django, so i dont understand why my custom login page dont work

You need to “intercept” the /admin/login/ url and direct it to your view.

Normally, when using the admin facility, you’ll have an entry in your base file that looks like this:

Before that line, you should be able to insert an entry:
path('admin/login/', views.logins, name='login'),

This will catch any reference to that url and direct it to your view instead of it being handled by the admin login process.