Add full hash, date and latest tag to about.html

Close #78
This commit is contained in:
Aarni
2017-10-25 18:27:44 +03:00
parent 82ada111e6
commit 601050baf6
2 changed files with 14 additions and 2 deletions
+3 -1
View File
@@ -7,6 +7,8 @@
</head> </head>
<body> <body>
<h1>SIKWEB 2.0</h1> <h1>SIKWEB 2.0</h1>
{{ TAG }} <p>{{ commit }}</p>
<p>{{ date }}</p>
<p>{{ tag }}</p>
</body> </body>
</html> </html>
+11 -1
View File
@@ -11,6 +11,7 @@ from django.conf import settings
import logging import logging
import requests import requests
from dealer.git import git
from webapp.models import PresetKaehmyRole, CustomKaehmyRole from webapp.models import PresetKaehmyRole, CustomKaehmyRole
from webapp.models import OhlhafvChallenge, KaehmyForm, TelegramChannel from webapp.models import OhlhafvChallenge, KaehmyForm, TelegramChannel
@@ -81,7 +82,16 @@ def logout_view(request, *args, **kwargs):
@require_http_methods(["GET"]) @require_http_methods(["GET"])
def about_view(request, *args, **kwargs): def about_view(request, *args, **kwargs):
"""Render about page.""" """Render about page."""
return render(request, "about.html", {}) repo = git.init_repo()
latest_commit = repo.git("rev-parse HEAD").decode('utf-8')
latest_date = repo.git("show -s --format=%ci " + latest_commit).decode('utf-8')
latest_tag = repo.git("describe --tags " + repo.git("rev-list --tags --max-count=1").decode('utf-8')).decode('utf-8')
context = {
'commit': latest_commit,
'date': latest_date,
'tag': latest_tag
}
return render(request, "about.html", context)
@require_http_methods(["GET"]) @require_http_methods(["GET"])