Show wether a user is logged in

| Tag python  django  auth 

In template file, we have a user, which is provided by Django via auth app:

{% if user.is_authenticated %}
	<a class="nav-link" href="#">Logout ({{ user.username }})</a>
{% else %}
	<a class="nav-link" href="#">Login</a>
	<a class="nav-link" href="#">Sign Up</a>
{% endif %}

Prev     Next