cannot run condition if-else in django -
i want check if user logged in:
{% if userprofile.is_autenticated %} <li><a href="{% url 'kerajinan.views.profile' %}"><i class="fa fa-user"></i>{{ user.get_username }}</a></li> <li><a href="{% url 'django.contrib.auth.views.logout' %}">sign out</a></li> {% else %} <li><a href="{% url 'django.contrib.auth.views.login' %}"><i class="fa fa-lock"></i> login</a></li> {% endif %}
but when i'm logged in, uses code:
<li><a href="{% url 'django.contrib.auth.views.login' %}"><i class="fa fa-lock"></i> login</a></li>
i made custom user model manage users.
you need set auth_user_model
in settings
, can read this more info.