Implement Git revision in superuser template

This commit is contained in:
Kumi 2019-01-31 16:32:15 +00:00
parent 32bde8ee00
commit b76b3acd49
2 changed files with 4 additions and 2 deletions

View file

@ -9,7 +9,8 @@ def getCommit():
repo = Repo(settings.BASE_DIR)
return "%s (%s)" % (str(repo.head.commit)[:7], str(repo.head.commit.committed_datetime))
@register.simple_tag
def isLatestCommit():
repo = Repo(settings.BASE_DIR)
origin = repo.remotes[0].refs[0]
return origin.commit.committed_datetime <= repo.head.commit.committed_datetime
return "" if origin.commit.committed_datetime <= repo.head.commit.committed_datetime else " Update available!"

View file

@ -11,6 +11,7 @@
<title>VPN360 Device Administration</title>
{% load static %}
{% load repo %}
{% block header %}
{% endblock %}
@ -69,7 +70,7 @@
<footer class="footer">
<div class="container">
<span class="text-muted">&copy; <a style="color: rgb(108, 117, 125);" href="https://kumi.systems/">Kumi Systems e.U.</a></span>
<span class="text-muted">&copy; <a style="color: rgb(108, 117, 125);" href="https://kumi.systems/">Kumi Systems e.U.</a>{% if user.is_superuser %}<br/>Git Revision: {% getCommit %}{% isLatestCommit %}{% endif %}</span>
</div>
</footer>