Re: user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-31 Thread cmawebsite
or for a specific user: from django.contrib.sessions.models import Session any(s.get_decoded().get('_auth_user_id') == user.id for s in Session.objects .all()) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-31 Thread cmawebsite
something like this may work: from django.contrib.auth.models import User from django.contrib.sessions.models import Session User.objects.filter(id__in=(s.get_decoded().get('_auth_user_id') for s in Session.objects.all())) for s in Session.objects.all() -- You received this

Re: user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-31 Thread Chris Seberino
Is there a way to answer your question "is user x logged into the website right now" in Django code? On Thursday, July 31, 2014 11:05:29 AM UTC-5, cmawe...@gmail.com wrote: > > Right, the question isn't "is user x logged into the website right now", > it actually only makes sense for for

Re: user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-31 Thread cmawebsite
Right, the question isn't "is user x logged into the website right now", it actually only makes sense for for request.user. This will return all users in the database: logged_in_users = [user for user in User.objects.all() if user.is_authenticated()] -- You received this message because you

Re: user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-29 Thread Andreas Kuhne
Hi Chris, is_authenticated() on a User should always be true. The reason for this is that you check the function on the request.user object. When a user is logged in, it will be true, however, the AnonymousUser returns false, which is the default when a user has not logged in. So you can only

user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-29 Thread Chris Seberino
I tried viewing the value of is_authenticated() for a user and it always is true...before and after logging in and after signing out. I'm trying to determine if a user has logged in or not. Is this the right variable to use? Why not changing? Thanks. cs -- You received this message