diff --git a/src/invenflask/app.py b/src/invenflask/app.py index eba963c..2581315 100644 --- a/src/invenflask/app.py +++ b/src/invenflask/app.py @@ -9,9 +9,11 @@ from importlib.metadata import version, PackageNotFoundError from sqlalchemy.exc import IntegrityError from werkzeug.utils import secure_filename +from flask_moment import Moment from .models import Asset, Staff, Checkout, History, db + app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv( 'DATABASE_URI', 'sqlite:////tmp/test.db') @@ -19,11 +21,21 @@ app.config['TEMPLATES_AUTO_RELOAD'] = True app.config['SECRET_KEY'] = os.urandom(24) app.config['upload_folder'] = 'uploads' +moment = Moment(app) # Init DB db.init_app(app) migrate = Migrate(app, db) +# @app.context +# def inject_settings(): +# if not db.session.query(GlobalSet).filter(GlobalSet.settingid == "timezone"): +# db.session.add(GlobalSet(settingid="timezone", setting="UTC")) +# db.session.commit() +# else: +# print("timezone already set") +# return dict(settings=db.session.query(GlobalSet).all()) + @app.context_processor def get_version(): diff --git a/src/invenflask/templates/base.html b/src/invenflask/templates/base.html index d12b63b..32bc73a 100644 --- a/src/invenflask/templates/base.html +++ b/src/invenflask/templates/base.html @@ -48,6 +48,10 @@ History +