diff options
author | doc <doc@filenotfound.org> | 2025-06-28 21:03:28 +0000 |
---|---|---|
committer | doc <doc@filenotfound.org> | 2025-06-28 21:03:28 +0000 |
commit | 86ee174c9d81c0ed5672113fcd8e76cf30c671ec (patch) | |
tree | 78336d6aee604dad9d385b275fff7016699bd33b /models.py |
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/models.py b/models.py new file mode 100644 index 0000000..dc510bb --- /dev/null +++ b/models.py @@ -0,0 +1,21 @@ +from flask_sqlalchemy import SQLAlchemy +from flask_login import UserMixin # Import UserMixin for Flask-Login integration + +db = SQLAlchemy() + +class User(UserMixin, db.Model): # Inherit from UserMixin! + id = db.Column(db.Integer, primary_key=True) + username = db.Column(db.String(100), unique=True, nullable=False) + email = db.Column(db.String(120), unique=True, nullable=False) + password_hash = db.Column(db.String(255), nullable=False) + + def check_password(self, password): + from werkzeug.security import check_password_hash + return check_password_hash(self.password_hash, password) + +class Toot(db.Model): + id = db.Column(db.String(36), primary_key=True) + message = db.Column(db.String(255), nullable=False) + toot_time = db.Column(db.String(5), nullable=False) + day = db.Column(db.String(9), nullable=False) + suspended = db.Column(db.Boolean, default=False) |