diff --git a/src/core/pyros_django/dashboard/templatetags/tags.py b/src/core/pyros_django/dashboard/templatetags/tags.py index 1f3783c..9ee4b8c 100644 --- a/src/core/pyros_django/dashboard/templatetags/tags.py +++ b/src/core/pyros_django/dashboard/templatetags/tags.py @@ -3,6 +3,7 @@ from django.contrib.auth.models import User #from common.models import Config, PyrosUser, PyrosState from common.models import Config, PyrosUser, UserLevel from datetime import date +from django.conf import settings register = template.Library() @@ -65,6 +66,11 @@ def user_level(request): return str(UserLevel.objects.get(priority=request.user.get_priority()).name) else: return UserLevel.objects.get(name="Visitor").name + +@register.simple_tag +def get_version_number(): + return settings.VERSION_NUMBER + @register.simple_tag() def can_view_settings(request): if request.user.is_authenticated : diff --git a/src/core/pyros_django/misc/templates/base.html b/src/core/pyros_django/misc/templates/base.html index e28e4c7..0e1a541 100644 --- a/src/core/pyros_django/misc/templates/base.html +++ b/src/core/pyros_django/misc/templates/base.html @@ -20,7 +20,8 @@ - + + @@ -221,6 +222,7 @@ footer{ {% load tags %} {% user_level request as USER_LEVEL %} {% can_view_settings request as CAN_VIEW_SETTINGS %} +{% get_version_number as version_number %} {% comment %} {% get_level "TAC" as USER_LEVEL_TAC %} @@ -588,7 +590,7 @@ footer{ diff --git a/src/core/pyros_django/pyros/settings.py b/src/core/pyros_django/pyros/settings.py index 337509d..c9aed73 100644 --- a/src/core/pyros_django/pyros/settings.py +++ b/src/core/pyros_django/pyros/settings.py @@ -44,7 +44,10 @@ MODULES_VERSIONS = { -import os,re,platform +import os,re,platform, subprocess +from datetime import date, datetime + +import django # duplicate from the same function in pyros.py ... def set_environment_variables_if_not_configured(env_path: str,env_sample_path: str)->None: """ @@ -392,4 +395,11 @@ else: # from django.core.cache import cache # cache.clear() -EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' \ No newline at end of file +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + +python_version = subprocess.run( "python --version | cut -d ' ' -f 2 | cut -d '.' -f 1,2",shell=True,stdout=subprocess.PIPE,universal_newlines=True) +python_version = python_version.stdout +today = datetime.utcnow().date() +django_version_major,django_version_minor = django.VERSION[:2][0],django.VERSION[:2][1] +pyros_version = "0.2.5.0" +VERSION_NUMBER = f"{pyros_version}_{django_version_major}.{django_version_minor}_{python_version}_{today}" \ No newline at end of file -- libgit2 0.21.2