I have is_active = db.Column(db.Boolean(), nullable=False)
field in user model in my flask app
now when am loging in, I get the error TypeError: 'bool' object is not callable
Traceback
.
.
.
File "/home/environments/flask0101/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/flask/myapp/app/auth/views.py", line 15, in login
login_user(user)
File "/home/environments/flask0101/lib/python2.7/site-packages/flask_login.py", line 675, in login_user
if not force and not user.is_active():
TypeError: 'bool' object is not callable
What is the issue?
is_active
is bool object.
>>> is_active = True
>>> is_active()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'bool' object is not callable
Just use it as a predicate, instead of calling it:
if not force and not user.is_active:
...