I'm using Django 1.9 and following along on this tutorial: https://www.youtube.com/watch?v=6WkQOlYgkHM&index=15&list=PLEsfXFp6DpzQFqfCur9CJ4QnKQTVXUsRy
When I put in the following code as recommended:
def post_list(request):
# return HttpResponse("<h1>Update</h1>")
if request.user.is_authenticated():
context = {
"title": "My User List"
}
else:
context = {
"title": "List"
}
return render(request, "index.html", context)
I get the following error message:
AttributeError: 'WSGIRequest' object has no attribute 'user'
I looked up the documentation and tried doing this:
from django.contrib.auth.models import user
But user
is underlined on my pycharm and now the error message I'm getting is
ImportError: cannot import name 'user'