Django “login() takes exactly 1 argument (2 given)” error

后端 未结 3 1631
轻奢々
轻奢々 2021-01-30 10:02

I\'m trying to store the user\'s ID in the session using django.contrib.auth.login . But it is not working not as expected.

I\'m getting error login() takes exac

3条回答
  •  难免孤独
    2021-01-30 10:42

    Another way:

    from django.contrib.auth import login as auth_login
    

    then call auth_login(request, user) instead of login(request, user).

提交回复
热议问题