I'm writing a custom login functionality in the Django rest framework. But I can't check if the password is correct or not.
class LoginView(APIView):
def post(self, request):
username=request.data["username"]
password=request.data["password"]
user=User.objects.filter(username=username)
if user is None:
return Response({"response":"No User exist"})
if user.check_password(password):
return Response({"response":"correct Password"})
return Response({"data":"done"})
the problem is check_password function is not working.Is there any right way to do that or do I miss something in between?