diff --git a/mayan/apps/appearance/templates/appearance/about.html b/mayan/apps/appearance/templates/appearance/about.html index 654dfe98bc..1418c4b138 100644 --- a/mayan/apps/appearance/templates/appearance/about.html +++ b/mayan/apps/appearance/templates/appearance/about.html @@ -58,8 +58,12 @@
{% blocktrans with build_number as build_number %}Build number: {{ build_number }}{% endblocktrans %}
+ {% endif %}{% project_description as project_description %} {% trans project_description %} diff --git a/mayan/apps/common/templatetags/common_tags.py b/mayan/apps/common/templatetags/common_tags.py index 50dc050544..b6ed9f6583 100644 --- a/mayan/apps/common/templatetags/common_tags.py +++ b/mayan/apps/common/templatetags/common_tags.py @@ -2,6 +2,8 @@ from __future__ import unicode_literals from json import dumps +import sh + from django.conf import settings from django.template import Context, Library from django.template.loader import get_template @@ -12,6 +14,14 @@ from ..utils import return_attrib register = Library() +try: + BUILD = sh.Command('git').bake('describe', '--tags', '--always', 'HEAD') + DATE = sh.Command('git').bake('--no-pager', 'log', '-1', '--format=%cd') +except sh.CommandNotFound: + logger.debug('git not found') + BUILD = None + DATE = None + @register.filter def get_encoded_parameter(item, parameters_dict): @@ -61,3 +71,11 @@ def render_subtemplate(context, template_name, template_context): new_context = Context(context) new_context.update(Context(template_context)) return get_template(template_name).render(new_context) + + +@register.assignment_tag +def build(): + if BUILD: + return '{} {}'.format(BUILD(), DATE().decode()) + else: + return 'No build information'