문제

My website use to login function of django.contrib.auth.views.login.

But, some pages has problems about getting user information.

I tried to request.user & request.user.is_authenticated(). then request.user = "admin"(ok) but, request.user.is_authenticated() = guest.. And, Staying logged in After close browser. what is problem?

Thank you.

도움이 되었습니까?

해결책

If some pages will not show {{ user }} but others will, you're most likely not using RequestContext in the views where the user isn't available.

You can use a function like django's render shortcut to automatically use RequestContext.

As for the user staying logged in after closing the browser - that's normal. Your user is identified by a cookie that sits on your browser and is persistent.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top