From f7fed92f02c157f1e0c1278ad78ee0f87551aea6 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Sun, 30 Aug 2020 23:36:17 +0200 Subject: dynamicaly check for commit id --- .gitattributes | 1 - client/templates/client/about.html | 2 +- client/views.py | 5 ++++- version.txt | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 53a472b..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -version.txt ident diff --git a/client/templates/client/about.html b/client/templates/client/about.html index ea32787..8de95a9 100644 --- a/client/templates/client/about.html +++ b/client/templates/client/about.html @@ -13,7 +13,7 @@

- Versione software {{version}} + Versione software {{version}}
Commit ID: {{commitid}}

Licenza
diff --git a/client/views.py b/client/views.py index 11ff367..01909d7 100644 --- a/client/views.py +++ b/client/views.py @@ -11,6 +11,7 @@ from django.template.loader import get_template from io import BytesIO import pdfkit import base64 +from subprocess import check_output def index(request): @@ -298,5 +299,7 @@ def about(request): version = f.read() if version.startswith("0"): version = "Beta " + version - context = {"version": version} + commitid = check_output(["git", "rev-parse", "HEAD"]).decode() + version = version[:version.find(" $Id: ")] + context = {"version": version, "commitid": commitid} return render(request, 'client/about.html', context) diff --git a/version.txt b/version.txt index 2b1e0ab..3b04cfb 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.2 $Id$ +0.2 -- cgit v1.2.1