diff --git a/BookingSystem/app.py b/BookingSystem/app.py index fa77f06..83d8134 100644 --- a/BookingSystem/app.py +++ b/BookingSystem/app.py @@ -5,6 +5,7 @@ import flask from dateutil import parser from flask_minify import Minify +from flask_session import Session from werkzeug.middleware.proxy_fix import ProxyFix import api @@ -16,7 +17,6 @@ import user from __init__ import logger, REGEX_ID, REGEX_ITEM, MIN_DAYS, MAX_DAYS, MIN_LABELS, MAX_LABELS from db import init_db, Settings -from flask_session import Session def create_app() -> flask.Flask: @@ -49,6 +49,10 @@ def _jinja2_filter_datetime(date, fmt='%d.%m.%Y') -> str: def _jinja2_filter_strftime(date, fmt='%d.%m.%Y') -> str: return datetime.fromtimestamp(float(date)).strftime(fmt) + @app.template_filter('unixtime') + def _jinja2_filter_unixtime(date) -> int: + return int(parser.parse(date, dayfirst=True).timestamp()) + @app.template_filter('split') def _jinja2_filter_split(string, split_char=',') -> list: return string.split(split_char) diff --git a/BookingSystem/templates/audits.html b/BookingSystem/templates/audits.html index 9b239c5..996c2a6 100644 --- a/BookingSystem/templates/audits.html +++ b/BookingSystem/templates/audits.html @@ -72,7 +72,7 @@

Her kan du søke i loggen etter forlatt utstyr, hva skjedde med det?

{% for audit in audits %} - {{ audit.timestamp }} + {{ audit.timestamp }} {{ audit.event }} {{ audit.message }}