I'm using django authentication to login the user:
def signin(request):
if request.method == "POST":
username = request.POST.get("username").lower()
password = request.POST.get("password").lower()
user = authenticate(username = username, password=password)
However, I can't seem to access the current user in any other view. In every template, I have access to the user, but I don't seem to access in the view itself. For example, in another route I want to be able to do the following:
def profile(request):
skills = hasSkill.objects.filter(user__username=user.username)
return render(request, "/profile.html", {"skills" : skills})
But I keep on getting an error that user is a Nonetype object. Any ideas?