Querying my database to get a user so I can log them out, but getting the above error.
def logout(request):
id = request.session["user_id"]
user = get_object_or_404(User, pk=id)
auth.logout(user)
I’m not trying to to say that User has a session attribute, I telling it that it’s primary key is equal to the number held in the session.
auth.logout()expectsrequestnot a user instance. Assuming you’re talking aboutdjango.contrib.authhttps://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.logout