Three - four questions: Django built-in auth user authentication error TypeError 'bool' object is not callable

Use Django comes with auth user authentication function, write function, use is_authenticated check whether the user is logged in, the result of an error:

TypeError at / 'bool' object is not callable

This line error prompt:

if request.user.is_authenticated() :

Other relevant information and found is_authenticated is a property rather than method, we should remove the brackets.

will

if request.user.is_authenticated() :

Changed

if request.user.is_authenticated :

Guess you like

Origin blog.csdn.net/Chengang98/article/details/86497029