I have a function like this in views.py:
def signin(request):
if request.method == 'POST':
uname = request.POST['username']
pwd = request.POST['password']
#and other code
And then i have another function like this:
def reservations(request):
try:
c = Utilisateur.objects.get(username = uname)
reserve = Reserve.objects.get(client = c)
return render (request, 'reservation.html', {'reserve':reserve})
except:
return HttpResponse ('you have no reservations!')
And i want to use the "uname" variable of the first function but it doesn't work any solution?
request.userany time after they are logged in. Django sets a cookie so it knows who the user is.