简体   繁体   English

Django检查用户是否已登录

[英]Django Check if Users are Logged In

To be clear, I'm not trying to check if the user is authenticated. 明确地说,我不是要检查用户是否已通过身份验证。 On my app, I want users to be able to see whether other users they are friends with are currently logged in or not. 在我的应用程序上,我希望用户能够查看与他们成为朋友的其他用户当前是否已登录。 Can someone point me in the right direction. 有人可以指出我正确的方向。

You need to make sure their sessions expire after they log out. 您需要确保他们的会话在注销后过期。

Then you need to query the django session model and to see who's online you need to match the friend with the session in the django session model 然后,您需要查询django会话模型,并查看谁在线,您需要将朋友与django会话模型中的会话进行匹配

sorry not much help code wise 对不起,没有太多帮助代码明智

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

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