distribusi-verse/verse/models/user_model.py

22 lines
736 B
Python
Raw Normal View History

2024-04-24 23:05:36 +02:00
from flask_login import UserMixin
2024-04-21 20:44:08 +02:00
2024-04-28 13:04:07 +02:00
from app import db
2024-04-21 20:44:08 +02:00
class User(UserMixin, db.Model):
2024-05-28 23:02:17 +02:00
"""User model class for a user in distribusi-verse"""
2024-04-21 20:44:08 +02:00
2024-05-28 23:02:17 +02:00
__tablename__ = "users"
2024-04-21 20:44:08 +02:00
2024-05-28 23:02:17 +02:00
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)
resethash = db.Column(db.String(300), nullable=True, unique=True)
resettime = db.Column(db.DateTime)
admin = db.Column(db.Boolean, default=False)
2024-04-21 20:44:08 +02:00
2024-05-28 23:02:17 +02:00
def __repr__(self):
return "<User %r>" % self.email