[Django]-How do I fix this error in Python Django involving request.user.is_authenticated() and bool object not callable?

11👍

In older versions of Django request.user.is_authenticated was a method. It’s now an attribute and no longer requires parenthesis. If you change your code to:

if request.user.is_authenticated:

It should be work as expected.

For more info see the docs here: https://docs.djangoproject.com/en/1.11/ref/contrib/auth/#django.contrib.auth.models.User.is_authenticated

👤Asher

-2👍

you forget to import csrf module please try to add this line and make sure to avoid hardcoded urls try to use url names

from django.core.context_processors import csrf

Leave a comment