my User class is not inherited from UserMixin, but defines its own elements and functions necessary for entering checkboxes.
The login process only works if I set get_id () to return the email of the instance. if I try to do this by username or actual id, I do not receive an error message, but I noticed that I am not registered (I cannot access a URL that requires me to log in using @required_login )
class User(db.Model):
id = db.Column(db.Integer,primary_key=True)
email = db.Column(db.Unicode(128))
name = db.Column(db.Unicode(128))
password = db.Column(db.Unicode(1024))
authenticated = db.Column(db.Boolean, default=False)
posts = db.relationship('Post')
def is_active(self):
return True
def get_id(self):
return unicode(self.email)
def is_authenticated(self):
return self.authenticated
def is_anonymous(self):
return False
EDIT: at the moment, asking the question, I did not understand, get_id () should match load_user ()
@login_manager.user_loader
def load_user(email):
return User.get_user(email)