from project import db class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True, autoincrement=True) username = db.Column(db.String(128), unique=True, nullable=False) email = db.Column(db.String(128), unique=True, nullable=False) active = db.Column(db.Boolean, default=True, nullable=False) admin = db.Column(db.Boolean, default=False, nullable=False) def __init__(self, username, email): self.username = username self.email = email def to_json(self): return { 'id': self.id, 'username': self.username, 'email': self.email, 'active': self.active, 'admin': self.admin }