diff --git a/lib/templatetags/__init__.py b/lib/templatetags/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/lib/templatetags/libextras.py b/lib/templatetags/libextras.py new file mode 100644 index 000000000..692c15423 --- /dev/null +++ b/lib/templatetags/libextras.py @@ -0,0 +1,18 @@ +import os +from django import template +from mailng.lib import exec_cmd + +register = template.Library() + +@register.simple_tag +def get_version(): + if os.path.isdir(".hg"): + version = "dev-" + code, output = exec_cmd("hg id -i") + version += output.rstrip() + return version + elif os.path.exists("VERSION"): + code, output = exec_cmd("cat VERSION") + return output.rstrip() + else: + return "Unknown" diff --git a/templates/registration/login.html b/templates/registration/login.html index f5b23a6bc..fdc3f77db 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -1,4 +1,5 @@ {% load i18n %} +{% load libextras %} @@ -21,7 +22,7 @@ {% if error %}

{{ error }}

{% endif %} -

2010 - Version 0.7-dev

+

{% now "Y" %} - Version {% get_version %}

{% trans "Welcome" %}