models.py
544 Bytes
from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
email = db.Column(db.String(100), unique=True)
name = db.Column(db.String(1000))
login = db.Column(db.String(1000), unique=True)
password = db.Column(db.String(100))
def __repr__(self):
return "i: {}, n: {}, e: {}, l: {}, p: {}".format(self.id, self.name, self.email, self.login, self.password)