Added per app version display tag
This commit is contained in:
13
apps/common/templatetags/version_tags.py
Normal file
13
apps/common/templatetags/version_tags.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from django.template import Library
|
||||
from django.utils.importlib import import_module
|
||||
|
||||
register = Library()
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def app_version(app_name):
|
||||
try:
|
||||
app = import_module(app_name)
|
||||
return app.get_version()
|
||||
except ImportError:
|
||||
return u''
|
||||
@@ -14,6 +14,29 @@ check_settings = {'text': _(u'settings'), 'view': 'check_settings', 'famfam': 'c
|
||||
statistics = {'text': _(u'statistics'), 'view': 'statistics', 'famfam': 'table'}
|
||||
diagnostics = {'text': _(u'diagnostics'), 'view': 'diagnostics', 'famfam': 'pill'}
|
||||
|
||||
__version_info__ = {
|
||||
'major': 0,
|
||||
'minor': 5,
|
||||
'micro': 0,
|
||||
'releaselevel': 'alpha',
|
||||
'serial': 1
|
||||
}
|
||||
|
||||
def get_version():
|
||||
"""
|
||||
Return the formatted version information
|
||||
"""
|
||||
vers = ["%(major)i.%(minor)i" % __version_info__, ]
|
||||
|
||||
if __version_info__['micro']:
|
||||
vers.append(".%(micro)i" % __version_info__)
|
||||
if __version_info__['releaselevel'] != 'final':
|
||||
vers.append('%(releaselevel)s%(serial)i' % __version_info__)
|
||||
return ''.join(vers)
|
||||
|
||||
__version__ = get_version()
|
||||
|
||||
|
||||
main_menu = [
|
||||
{'text': _(u'home'), 'view': 'home', 'famfam': 'house', 'position': 0},
|
||||
{'text': _(u'tools'), 'view': 'tools_menu', 'links': [
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load project_tags %}
|
||||
{% load version_tags %}
|
||||
{% block title %} :: {% trans "About this program" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<div class="content">
|
||||
<h3 class="tc">
|
||||
{% project_name %}<br /><br />
|
||||
{% project_name %} ({% trans "Version" %} {% app_version "main" %})<br /><br />
|
||||
{% trans 'Open source, Django based document manager with custom metadata indexing, file serving integration and OCR capabilities' %}<br /><br />
|
||||
<a href="http://www.github.com/rosarior/mayan/">http://www.github.com/rosarior/mayan/</a><br /><br />
|
||||
<br/>{% trans "Released under the GPL V3 License" %}
|
||||
|
||||
Reference in New Issue
Block a user