html - Django Template: remove the buttons when session starts -
i trying make login authentication in django. have made sign in , sign buttons in upper navbar.
now need achieve when sign in application redirection take place , @ time session checked , if session has started sign in , sign button disappears , user abc button comes @ place.
i trying code snipped here is.
{% if request.session.loggedin %} <li><a data-toggle="modal" href="#"><b>hello chitrank</b></a></li> {% else %} <li><a data-toggle="modal" href="#signup"><b>sign up</b></a></li> <li><a data-toggle="modal" href="#signin"><b>sign in</b></a></li> {% endif %}
please suggest me , using wrong way check session or if there other way solution welcome.
{% if user.is_authenticated %}
is looking for. https://docs.djangoproject.com/en/dev/ref/templates/api/#django-contrib-auth-context-processors-auth
also allows this
<span>welcome {{ user.username }}!</span>
Comments
Post a Comment