distribusi-verse/verse/usermodel.py

20 lines
693 B
Python

from app import db
from flask_login import UserMixin
class User(UserMixin, db.Model):
"""User model class for a user in distribusi-verse"""
__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)
currentdistribusi = db.Column(db.String(300), nullable=True, unique=False)
admin = db.Column(db.Boolean, server_default="false")
tutor = db.Column(db.Boolean, server_default="false")
def __repr__(self):
return "<User %r>" % self.email