Flask-login AttributeError: 'User' object has no attribute 'is_active'
You should subclass UserMixin
on your model. You should also add a user_loader
from flask.ext.login import UserMixin
from yourapp import login_manager
@login_manager.user_loader
def get_user(ident):
return User.query.get(int(ident))
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
### yada yada, you know what goes here
From the Flask-login documentation, it specifically says:
"To make implementing a user class easier, you can inherit from UserMixin, which provides default implementations for all of these methods. (It’s not required, though."
The methods refered will be: is_authenticated(), is_active(), is_anonymous() and get_id(), which by the look of your model, they are missing. Once you implement those functions to your model, there should be no problem with Flask-login.