Объект не имеет атрибута '_meta' в django

я новичок в django и sqlite. я хочу сделать систему входа. но я застрял.

Exception Value:  'tuple' object has no attribute '_meta'

вот мой код:

def index(request):
if request.method == 'POST':
    usernames = request.POST['name']
    passwords = request.POST['pass']
    c.execute(f"SELECT * FROM ogrenciler WHERE ogrenci=? AND sifre=?",(usernames,passwords))
    a= c.fetchone()
    if not a:
        return redirect("index")
    elif a:
        auth.login(request,a)
        return redirect("test")
else:
    return render(request, 'pages/index.html')

как я могу это решить? моя проблема заключается в auth.login(request,a)

Вернуться на верх