From 93c2d4f92adb78137717bccfe389620da014e38c Mon Sep 17 00:00:00 2001 From: Eric Phillips Date: Sat, 16 Oct 2021 12:19:55 -0600 Subject: [PATCH] dashboard --- flaskfdx/__init__.py | 9 ++++----- flaskfdx/dashboard.py | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 flaskfdx/dashboard.py diff --git a/flaskfdx/__init__.py b/flaskfdx/__init__.py index 1190c58..faf6479 100644 --- a/flaskfdx/__init__.py +++ b/flaskfdx/__init__.py @@ -23,15 +23,14 @@ def create_app(test_config=None): except OSError: pass - # simple hello world page - @app.route('/hello') - def hello(): - return 'Hello World!' - from . import db db.init_app(app) from . import auth app.register_blueprint(auth.bp) + from . import dashboard + app.register_blueprint(dashboard.bp) + app.add_url_rule('/', endpoint='index') + return app diff --git a/flaskfdx/dashboard.py b/flaskfdx/dashboard.py new file mode 100644 index 0000000..891126e --- /dev/null +++ b/flaskfdx/dashboard.py @@ -0,0 +1,19 @@ +import functools + +from flask import( + Blueprint, flash, g, redirect, render_template, request, session, url_for +) +from werkzeug.exceptions import abort + +from flaskfdx.auth import login_required +from flaskfdx.db import get_db + +bp = Blueprint('dashboard', __name__) + +bp.route('/') +def index(): + db = get_db() + lastseven = db.execute( + 'SELECT * FROM total WHERE datetime(date) > datetime("now", "-8 days")' + ).fetchall() + return render_template('dashboard/index.html', lastseven=lastseven)