1
0
Fork 0
mirror of https://github.com/Findus23/acronomy.git synced 2024-09-18 14:33:43 +02:00

show version

This commit is contained in:
Lukas Winkler 2020-06-15 20:12:30 +02:00
parent 4107ffb086
commit ea084cdde8
Signed by: lukas
GPG key ID: 54DE4D798D244853
5 changed files with 24 additions and 1 deletions

View file

@ -3,3 +3,4 @@ from django.apps import AppConfig
class AcrosConfig(AppConfig):
name = 'acros'
verbose_name = "Acronomy"

View file

@ -1,4 +1,5 @@
{% extends 'base.html' %}
{% load version %}
{% load static %}
@ -12,6 +13,7 @@
{% block content %}
{% if acro.description_html %}
{% commit_id %}
<div class="description">
{{ acro.description_html|safe }}
</div>

View file

View file

@ -0,0 +1,16 @@
from subprocess import run
from django import template
from django.core.cache import cache
register = template.Library()
@register.simple_tag
def commit_id():
commit = cache.get("commit")
if not commit:
sp = run(["git", "rev-parse", "--verify", "HEAD"], capture_output=True)
commit = sp.stdout.decode().strip()
cache.set("commit", commit)
return commit

View file

@ -1,7 +1,11 @@
{% load version %}
<footer>
<ul class="nav">
<li class="nav-item">
<a class="nav-link" href="https://github.com/Findus23/acronomy/" target="_blank" rel="noopener">Source</a>
<a class="nav-link" href="https://github.com/Findus23/acronomy/tree/{% commit_id %}"
target="_blank" rel="noopener" title="{% commit_id %}">
Source
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://lw1.at/i">Privacy</a>