-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
23 lines (19 loc) · 891 Bytes
/
models.py
File metadata and controls
23 lines (19 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from orm import db
from flask_login import UserMixin
class User(db.Model, UserMixin):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
official_username = db.Column(db.String(64), nullable=False, unique=True)
password_hash = db.Column(db.String(), nullable=False)
email = db.Column(db.String, unique=True)
is_email_confirmed = db.Column(db.Integer(), default=0, nullable=False)
icon = db.Column(db.LargeBinary(), nullable=False)
public_username = db.Column(db.String(32))
description = db.Column(db.String(1024))
def __repr__(self) -> str:
return "{class_name}.{official_username}(id={id}, public_username={public_username})".format(
class_name=self.__class__.__name__,
official_username=self.official_username,
id=self.id,
public_username=self.public_username
)