2012-11-21 31 views

回答

1

在你的模板:

{% if user.is_authenticated %} 
    <!-- display nav bar for the logged in user --> 
{% else %} 
    <!-- display login form or whatever you need --> 
{% endif %} 

Django的你總是在請求信息,並將該簡單的身份驗證的用戶if/else語句與你所需要的幫助。你可以明顯地使這是一個Ajax調用並調用HTML,而不需要一個新的請求的

更多信息in the docs

相關問題