I have two headers header.html and headersuccess.html . I user is logged in, I need to change the header.html as headersuccess.html. How can I able to implement that?
My views.py is.. By this I am going to loginsuccess.html.. So, if login is success I need to change header from header.html to hadersuccess.html
def logsuccess(request):
if('loggedIn' in request.session):
id = request.session['uid'];
return render(request,"loginsuccess.html",{'uid':id});
else:
return render(request,"failed.html",{});
I am getting uid using this. I am using html and vue js for displaying.
You can do this in the view:
def logsuccess(request):
if request.user.is_authenticated():
id = request.user.id
return render(request, "loginsuccess.html", {'uid': id})
else:
return render(request, "failed.html", {})
You'll probably also want to read up on PEP-8 to follow Python coding conventions. Good luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.