简体   繁体   English

如何检查Django是否登录了“不同”用户?

[英]How do I check if a 'different' user is logged in in django?

Every where I look for 'checking if user is logged in' directs me to checking if the currently logged in user is logged in. If I have a list of friends, and I want to see who in that list is logged in. How can I check that? 我寻找“检查用户是否已登录”的每个地方都会引导我检查当前登录的用户是否已登录。如果我有一个好友列表,并且我想查看该列表中的谁已登录。我检查一下吗?

I've tried 'user.is_authenticated()' on the friends, but it always comes back as 'True'?? 我已经在朋友上尝试了“ user.is_authenticated()”,但它总是以“ True”的形式返回?

You can get this data from sessions table. 您可以从会话表中获取此数据。

Check this question How to get the list of the authenticated users? 检查此问题如何获取经过身份验证的用户列表?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM