Django, request.user is always Anonymous User

后端 未结 9 2078
无人共我
无人共我 2020-12-01 14:57

I am using a custom authentication backend for Django (which runs off couchdb). I have a custom user model.

As part of the login, I am doing a request.user = u

9条回答
  •  自闭症患者
    2020-12-01 15:19

    user = authenticate(username=username, password=password) 
    if user is not None:
       return render(request, 'home.html',{'user_id':user.id})
    

提交回复
热议问题