is_authenticated in django

  • It's a method, not a property. 
  • You need to call it:
         if u.is_authenticated():

  • is_authenticated is a method, so you need some parentheses there. 
  • Otherwise, u.is_authenticated is the function object, which is a True value.
  • In the template language, functions with no arguments are evaluated as functions, so that's why you're good there.

No comments:

Post a Comment