This commit is contained in:
Julien Constant
2023-03-14 12:15:35 +01:00
parent 6f6d65b663
commit 87b5ff12c5
5 changed files with 35 additions and 14 deletions

View File

@ -36,6 +36,7 @@ from django.core.exceptions import ValidationError
from django.utils import timezone
from core import utils
from core.models import User, Preferences, RealGroup, Notification, SithFile
from club.models import Club
@ -46,6 +47,7 @@ class Sith(models.Model):
alert_msg = models.TextField(_("alert message"), default="", blank=True)
info_msg = models.TextField(_("info message"), default="", blank=True)
weekmail_destinations = models.TextField(_("weekmail destinations"), default="")
version = utils.get_git_revision_short_hash()
def is_owned_by(self, user):
return user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID)

View File

@ -1730,6 +1730,11 @@ footer {
}
}
}
> .version {
margin-top: 3px;
color: rgba(0, 0, 0, .3)
}
}
/*---------------------------------FORMS-------------------------------*/

View File

@ -282,6 +282,10 @@
{% trans %}Site created by the IT Department of the AE{% endtrans %}
</a>
{% endblock %}
<br>
<code class="version">
{% trans %}Sith version:{% endtrans %}&nbsp;{{ get_sith().version }}
</code>
</footer>
{% endif %}
<!--

View File

@ -22,6 +22,7 @@
#
#
import subprocess
import re
# Image utils
@ -37,6 +38,11 @@ import PIL
from django.conf import settings
from django.core.files.base import ContentFile
def get_git_revision_short_hash() -> str:
"""
Return the short hash of the current commit
"""
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()
def get_start_of_semester(d=date.today()):
"""

View File

@ -1644,6 +1644,10 @@ msgstr "Appels affichés"
msgid "Calls to moderate"
msgstr "Appels à modérer"
#: core/templates/core/base.jinja
msgid "Site version:"
msgstr "Version du site :"
#: com/templates/com/news_admin_list.jinja:242
#: core/templates/core/base.jinja:177
msgid "Events"