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

后端 未结 6 1855
挽巷
挽巷 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:50

    Following block should work:

        {% if user.is_authenticated %}
            

    Welcome {{ user.username }} !!!

    {% endif %}

提交回复
热议问题