I'm newbie to Django. I'm stuck at one thing that, my login authenticate method return None. I've tried my best to search and try to solve this but i didn't find my problem solution. In Following First Code Sample From Which I Got Error,
`def loginAdmin(request):
if request.method == "POST":
username = request.POST['username'],
password = request.POST['password'],
user = auth.authenticate(username = username, password = password)
if user is not None:
auth.login(request, user)
return redirect('/admin-dashboard')
else:
messages.info(request, 'invalid')
else:
return HttpResponse('No')
# return render(request,'login.html') `
I'm getting value of form and using variable in authenticate method but its giving me that error. But in Following Second Code Sample That Execute Successfully ` def loginAdmin(request):
if request.method == "POST":
username = request.POST['username'],
password = request.POST['password'],
user = auth.authenticate(username = 'user1', password = 'pass123')
if user is not None:
auth.login(request, user)
return redirect('/admin-dashboard')
else:
messages.info(request, 'invalid')
else:
return HttpResponse('No')
# return render(request,'login.html')
` if, I used hard coded value in authenticate method that i know saved in database username and password, then it will execute successful. I've debug form username and password They are coming. I tried to elaborate my problem. Please guide me how to solve this. Thank You. Screen Shot 1 Link: Having error in This Screen Shot 2 Link: But No error if Hard Coded Value
username
andpassword
during the request ? – Kashyap KN