hanze/programmeerles-ouderen

tering python-imports (c2d4aa0de5282f208e5b9610bf68019ce0d43821)
Repositories

commit c2d4aa0de5282f208e5b9610bf68019ce0d43821
parent 704ff03bb45ea93be2c9b130c1302f07c97cdaf2
Author: Friedel Schön <[email protected]>
Date:   Mon,  4 Apr 2022 14:30:31 +0200

tering python-imports

Diffstat:
Mflaskblog/__init__.py2+-
Mflaskblog/models.py22++++++++++++++--------
2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/flaskblog/__init__.py b/flaskblog/__init__.py @@ -12,4 +12,4 @@ login_manager = LoginManager(app) login_manager.login_view = 'login' login_manager.login_message_category = 'info' -from programmeerles import routes +from flaskblog import routes diff --git a/flaskblog/models.py b/flaskblog/models.py @@ -1,7 +1,9 @@ from datetime import datetime -from . import db, login_manager + from flask_login import UserMixin +from . import db, login_manager + @login_manager.user_loader def load_user(user_id): @@ -10,28 +12,33 @@ def load_user(user_id): class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) - type = db.Column(db.string(6), nullable=False, default="client") + type = db.Column(db.String(6), nullable=False, default="client") username = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) - image_file = db.Column(db.String(20), nullable=False, default='default.jpg') + image_file = db.Column(db.String(20), nullable=False, + default='default.jpg') password = db.Column(db.String(60), nullable=False) def __repr__(self): return f"User('{self.username}', '{self.email}', '{self.image_file}')" + class Language(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), nullable=False) info = db.Column(db.Text) - + def __repr__(self): return f"Language('{self.name}', '{self.info}')" - + + class Classes(db.Model): id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) - language_id = db.Column(db.Integer, db.ForeignKey('language.id'), nullable=False) - teacher_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) + language_id = db.Column(db.Integer, db.ForeignKey( + 'language.id'), nullable=False) + teacher_id = db.Column( + db.Integer, db.ForeignKey('user.id'), nullable=False) start = db.Column(db.DateTime, nullable=False) location = db.Column(db.String(120), nullable=False) @@ -39,7 +46,6 @@ class Classes(db.Model): return f"Language('{self.id}', '{self.language_id}', '{self.start}', '{self.location}')" - # date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) # content = db.Column(db.Text, nullable=False) # user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)