In Django, why is user.is_authenticated a method and not a member variable like is_staff

Posted by luc on Stack Overflow See other posts from Stack Overflow or by luc
Published on 2010-03-15T09:02:05Z Indexed on 2010/03/15 9:09 UTC
Read the original article Hit count: 289

Hello all,

I've lost some time with a bug in my app due to user authentication. I think that it's a bit confusing but maybe someone can explain the reason and it will appear to me very logical.

The user.is_staff is a member variable while user.is_authenticated is a method. However is_authenticated only returns True or False depending if the class is User or AnonymousUser (see http://docs.djangoproject.com/en/dev/topics/auth/)

Is there a reason for that? Why user.is_authenticated is a method?

Thanks in advance

© Stack Overflow or respective owner

Related posts about django

Related posts about python