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

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -