csv-library-website/library/application/models/usermodel.py

20 lines
603 B
Python

from flask_login import UserMixin
from app import db
class User(UserMixin, db.Model):
"""User model class for a user in the library"""
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(150), unique=True, nullable=False)
email = db.Column(db.String(150), unique=True, nullable=False)
password = db.Column(db.String(300), nullable=False, unique=False)
resethash = db.Column(db.String(300), nullable=True, unique=True)
resettime = db.Column(db.DateTime)
def __repr__(self):
return "<User %r>" % self.email