Beispiel #1
0
class Users(UserMixin, db.Model):
    __tablename__ = 'py_user'  # 对应mysql数据库表
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), unique=True, index=True)
    pwd = db.Column(db.String(64), unique=True, index=True)

    def __init__(self, name, pwd):
        self.id = 1
        self.name = name
        self.pwd = pwd

    def get_id(self):
        return unicode(self.id)

    def __repr__(self):
        return '<User %r>' % self.name

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_anonymous(self):
        return False
Beispiel #2
0
class Users(UserMixin, db.Model):
    __tablename__ = 'login'
    user_id = db.Column(db.Integer, primary_key=True)
    user_name = db.Column(db.String(64), unique=True, index=True)
    user_password = db.Column(db.String(64), unique=True, index=True)

    def __init__(self, name, pwd):
        self.user_name = name
        self.user_password = pwd

    def get_id(self):
        return self.user_id

    def __repr__(self):
        return '<User %r>' % self.user_name

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_anonymous(self):
        return False