I’m trying to check if user logged in in the main template using this:
JavaScript
x
4
1
{%if request.user%}
2
3
{%endif%}
4
but it’s not working maybe because main template doesn’t have a view could any one help i don’t know if the question duplicated,but i didn’t find my answer.
Advertisement
Answer
you could use:
JavaScript
1
4
1
{% if user.is_authenticated %}
2
3
{% endif %}
4