From 007ac37063407e91450e9af0073521941dbf6869 Mon Sep 17 00:00:00 2001 From: Dorian Lesbre <dorian.lesbre@gmail.com> Date: Tue, 30 Mar 2021 16:34:26 +0200 Subject: [PATCH] Added self-aware version number --- CHANGELOG.md | 1 + home/templates/admin.html | 2 +- home/templates/base.html | 5 +++-- site_settings/constants.py | 7 +++++++ site_settings/context_processors.py | 6 +++++- 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 site_settings/constants.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 3957ee6..2c827cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Added links to activities from profile page - Added admin warning for malformed activity wishes. - Fixed multiple day display on planning and added planning preview to admin files +- Added version number to admin pages ## Version 1.0.1 - day one patch - 2021-03-24 diff --git a/home/templates/admin.html b/home/templates/admin.html index 4f7a73d..98d219d 100644 --- a/home/templates/admin.html +++ b/home/templates/admin.html @@ -8,7 +8,7 @@ {% block "content" %} <h2>Page d'administration</h2> - + <p><strong>Version {{ constants.WEBSITE_FULL_VERSION }}</strong></p> <div class="flex wrap"> <a class="button" href="{% url 'participants.csv' %}"><i class="fa fa-download"></i> Liste des participants</a> <a class="button" href="{% url 'activities.csv' %}"><i class="fa fa-download"></i> Liste des activités</a> diff --git a/home/templates/base.html b/home/templates/base.html index 752376f..3d38e14 100644 --- a/home/templates/base.html +++ b/home/templates/base.html @@ -2,10 +2,11 @@ <!doctype html> <html lang="fr"> <head> + <!-- WEBSITE VERSION {{ constants.WEBSITE_FULL_VERSION }} --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>Interludes {% if settings.date_start %}{{ settings.date_start.year }}{% endif %}</title> + <title>Interludes{% if settings.date_start %} {{ settings.date_start.year }}{% endif %}</title> <meta name="description" content="Inscriptions et infos sur les interENS ludiques{% if settings.date_start %}, édition {{ settings.date_start.year }}{% endif %}"> <meta name="keywords" content="Interludes ENS événement COF {% if settings.date_start %}{{ settings.date_start.year }} {% endif %}InterENS"> <link rel="icon" type="image/png" href="{% static 'imgs/favicon.ico' %}"> @@ -17,7 +18,7 @@ <body> <header> <div id="header_logo"> - <h1><a href="/">Interludes {% if settings.date_start %}{{ settings.date_start.year }}{% endif %}</a></h1> + <h1><a href="/">Interludes{% if settings.date_start %} {{ settings.date_start.year }}{% endif %}</a></h1> </div> <div id="head_main_infos"> <div id="location">ENS Ulm</div> diff --git a/site_settings/constants.py b/site_settings/constants.py new file mode 100644 index 0000000..0d83e44 --- /dev/null +++ b/site_settings/constants.py @@ -0,0 +1,7 @@ +# The website version number +WEBSITE_VERSION = "1.0.1b" +WEBSITE_VERSION_DATE = "2021-03-24" + +WEBSITE_FULL_VERSION = "{} - {}".format( + WEBSITE_VERSION, WEBSITE_VERSION_DATE +) diff --git a/site_settings/context_processors.py b/site_settings/context_processors.py index eb33102..a16631b 100644 --- a/site_settings/context_processors.py +++ b/site_settings/context_processors.py @@ -1,4 +1,8 @@ +from site_settings import constants from site_settings.models import SiteSettings def settings(request): - return {'settings': SiteSettings.load()} + return { + 'settings': SiteSettings.load(), + 'constants' : constants, + } -- GitLab