0👍
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!
Source:stackexchange.com