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.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -