Django Session related question Question
My code main template: {% if 'userid' in request.session %} <a href="{% url 'homepage:writearticle' %}" id="artiplus"> <i class="fa fa-plus"></i> Article </a> <a href="#" title="user" style="color:tomato;"><i class="fa fa-user"></i> <span class="big">{{uname}}</span></a> <a href="{% url 'homepage:logout' %}" title="logout"><span class="big">Log Out</span> <i class="fa fa-sign-out"></i></a> {% else %} My views.py: def login(request): # do some validation request.session['userid'] = duname[0].pk sessionID = request.session['userid'] uname = UserModel.objects.get(pk=sessionID).uname return render(request, "homepage/index.html", {"sessionID": sessionID, "uname": uname}) so my problem is when i logged in, the data in "uname" gets displayed once BUT whenever i go to some other pages in my project the data in "uname" gets lost. Pliz Help Me.