mirror of
https://github.com/StefBuwalda/WebTech.git
synced 2025-10-30 03:10:00 +00:00
Cleanip init.py, utils.py and decorators.py
This commit is contained in:
@@ -20,9 +20,6 @@ db.init_app(app)
|
||||
|
||||
migrate = Migrate(app, db)
|
||||
|
||||
# bp import
|
||||
from application.auth.views import auth_blueprint
|
||||
from application.dash.views import dash_blueprint
|
||||
|
||||
# Login manager
|
||||
from application.auth.models import User
|
||||
@@ -32,6 +29,7 @@ login_manager.init_app(app) # type: ignore
|
||||
login_manager.login_view = "auth.login" # type: ignore
|
||||
|
||||
|
||||
# Gets all the user data
|
||||
@login_manager.user_loader # type: ignore
|
||||
def load_user(user_id): # type: ignore
|
||||
return User.query.get(int(user_id)) # type: ignore
|
||||
@@ -39,5 +37,14 @@ def load_user(user_id): # type: ignore
|
||||
|
||||
# Blueprint magic
|
||||
|
||||
# bp import
|
||||
# Would like to do this at the top of the file,
|
||||
# but can't easily figure out how to do this.
|
||||
# I think everything that the views depend on have to be moved
|
||||
# into a seperate .py and imported.
|
||||
from application.auth.views import auth_blueprint
|
||||
from application.dash.views import dash_blueprint
|
||||
|
||||
# Register blueprints
|
||||
app.register_blueprint(dash_blueprint, url_prefix="/dash")
|
||||
app.register_blueprint(auth_blueprint, url_prefix="/auth")
|
||||
|
||||
Reference in New Issue
Block a user