Code reviewed and issue fixed.
This commit is contained in:
+4
-1
@@ -112,7 +112,10 @@ def create_app(config_name=None):
|
||||
|
||||
@login_manager.user_loader
|
||||
def load_user(user_id):
|
||||
return User.query.get(int(user_id))
|
||||
# db.session.get() is the SQLAlchemy 2.x successor to the deprecated
|
||||
# Model.query.get(). Both hit the identity map first (no SQL if the
|
||||
# object is already in session), then fall back to a SELECT by PK.
|
||||
return db.session.get(User, int(user_id))
|
||||
|
||||
# ── Context processors ────────────────────────────────────────────────────
|
||||
@app.context_processor
|
||||
|
||||
Reference in New Issue
Block a user