How to check if a user is logged in (how to properly use user.is_authenticated)?

后端 未结 6 1838
挽巷
挽巷 2020-11-28 01:17

I am looking over this website but just can\'t seem to figure out how to do this as it\'s not working. I need to check if the current site user is logged in (authenticated),

6条回答
  •  迷失自我
    2020-11-28 01:55

    If you want to check for authenticated users in your template then:

    {% if user.is_authenticated %}
        

    Authenticated user

    {% else %} {% endif %}

提交回复
热议问题