I am creating a login form and after filling up the information it is showing 'str' object has no attribute 'get' error views.py file:
from django.shortcuts import render,redirect
from django.contrib import messages
from django.contrib.auth.models import User, auth
# Create your views here.
def login(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("home")
else:
messages.info(request,"invalid credentials")
return redirect('login')
else:
return render(request,'buy/login.html')