Skip to content

Commit

Permalink
feat(footer): add version display to footer (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
drahamim authored Nov 1, 2023
1 parent 4aeef00 commit 5ffec6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/invenflask/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sqlite3
from pathlib import Path
from importlib.metadata import version

import pandas as pd
from flask import (Flask, flash, g, redirect, render_template, request,
Expand All @@ -25,6 +26,11 @@
# print(app.config)


@app.context_processor
def get_version():
return dict(app_version=version("invenflask"))


def get_db_connection():
conn = sqlite3.connect('database.db')
conn.row_factory = sqlite3.Row
Expand Down
8 changes: 7 additions & 1 deletion src/invenflask/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,11 @@
</div>
{{ bootstrap.load_js() }}
</body>

<footer>
{% block footer %}
<div class="float-start">
<span class="badge bg-primary">AppVersion: {{ app_version }}</span>
</div>
{% endblock %}
</footer>
</html>

0 comments on commit 5ffec6c

Please sign in to comment.