[Answered ]-Django custom authentication doesn't redirect as expected

2👍

HttpResponse expects a string, or an iterable. You are getting the error because you have passed the user instance.

return HttpResponse(request.user)

Django tries to iterate over request.user and you get the error because model instances are not iterable.

You could change the view to return the username instead.

return HttpResponse(request.user.username)

Leave a comment