One the one hand i have an navbar.html template that can be extended by several other html templates. On the other hand in my views i have a login system and when a user logs in im creating a session value with user's name. i want to send this session value to the navbar html but without rendering this template. How could i do this?
login in view.py
name = form.cleaned_data.get('name')
password = form.cleaned_data.get('password')
user = Users.objects.filter(name=name, password=password)
if user.count() > 0:
request.session['user'] = user.name
return redirect("store/")
else:
messages.info(request, 'Invalid credentials')
return redirect("/login/")
the return redirect("store/")redirects to the store.html that extends the navbar.html. I want to send request.session['user'] to the navbar.html