简体   繁体   English

如何在Pinax中获取当前登录用户?

[英]How can I get the current logged in user in Pinax?

I'm using Pinax, and account type which offer the account management system. 我正在使用Pinax和提供帐户管理系统的帐户类型。

How can I get the current logged in user in my view? 如何在我的视图中获取当前登录用户?

You get the logged in user in Pinax the same way as you get the current logged in user in Django. 您在Pinax中获得登录用户的方式与在Django中获取当前登录用户的方式相同。 If you configure the Django auth app correctly, then the user is available as request.user . 如果您正确配置Django auth应用程序,则该用户可以request.user

def my_view(request):
    user = request.user

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

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