shaare.it

AttributeError: 'User' has no attribute 'is_authenticated' (property access)

7 Dec 2025

1 min read

AttributeError: ‘User’ has no attribute ‘is_authenticated’ (property access)

$ python manage.py shell -c "from django.contrib.auth.models import AnonymousUser; print(AnonymousUser().is_authenticated())"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: 'bool' object is not callable

Why this happens

In modern Django, is_authenticated is a property, not a method. Calling it like is_authenticated() leads to errors.

Fix

Use user.is_authenticated (no parentheses).

Wrong code

if request.user.is_authenticated():
    ...

Fixed code

if request.user.is_authenticated:
    ...