From 838aee6bdd7176ba6b800a84ebff2c0051078015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Tue, 3 Dec 2019 17:41:58 +0200 Subject: [PATCH] Show Healthchecks version in Django admin header cc: #306 --- CHANGELOG.md | 25 +++++++++++++------------ hc/front/templatetags/hc_extras.py | 5 +++++ hc/settings.py | 6 ++++++ templates/admin/base_site.html | 11 +++++++++++ 4 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 templates/admin/base_site.html diff --git a/CHANGELOG.md b/CHANGELOG.md index b57adf9a..4b880e08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,14 @@ # Changelog All notable changes to this project will be documented in this file. -## Unreleased +## v1.12.0-dev - Unreleased ### Improvements - "Filtering Rules" dialog, an option to require HTTP POST (#297) +- Show Healthchecks version in Django admin header (#306) -## 1.11.0 - 2019-11-22 +## v1.11.0 - 2019-11-22 ### Improvements - In monthly reports, no downtime stats for the current month (month has just started) @@ -21,7 +22,7 @@ All notable changes to this project will be documented in this file. - Make log events fit better on mobile screens -## 1.10.0 - 2019-10-21 +## v1.10.0 - 2019-10-21 ### Improvements - Add the "Last Duration" field in the "My Checks" page (#257) @@ -41,7 +42,7 @@ All notable changes to this project will be documented in this file. - Upgrade to Django 2.2.6 – fixes sqlite migrations (#284) -## 1.9.0 - 2019-09-03 +## v1.9.0 - 2019-09-03 ### Improvements - Show the number of downtimes and total downtime minutes in monthly reports (#104) @@ -55,7 +56,7 @@ All notable changes to this project will be documented in this file. - Fix javascript code to construct correct URLs when running from a subdirectory (#273) - Don't show the "Sign Up" link in the login page if registration is closed (#280) -## 1.8.0 - 2019-07-08 +## v1.8.0 - 2019-07-08 ### Improvements - Add the `prunetokenbucket` management command @@ -74,7 +75,7 @@ All notable changes to this project will be documented in this file. - Fix `prunepings` and `prunepingsslow`, they got broken when adding Projects (#264) -## 1.7.0 - 2019-05-02 +## v1.7.0 - 2019-05-02 ### Improvements - Add the EMAIL_USE_VERIFICATION configuration setting (#232) @@ -88,7 +89,7 @@ All notable changes to this project will be documented in this file. - Include the description in email alerts. (#247) -## 1.6.0 - 2019-04-01 +## v1.6.0 - 2019-04-01 ### Improvements - Add the "desc" field (check's description) to API responses @@ -104,7 +105,7 @@ All notable changes to this project will be documented in this file. - Fix a "invalid time format" in front.views.status_single on Windows hosts -## 1.5.0 - 2019-02-04 +## v1.5.0 - 2019-02-04 ### Improvements - Database schema: add uniqueness constraint to Check.code @@ -116,7 +117,7 @@ All notable changes to this project will be documented in this file. - Add the "My Projects" page -## 1.4.0 - 2018-12-25 +## v1.4.0 - 2018-12-25 ### Improvements - Set Pushover alert priorities for "down" and "up" events separately @@ -134,7 +135,7 @@ All notable changes to this project will be documented in this file. - Validate and reject cron schedules with six components -## 1.3.0 - 2018-11-21 +## v1.3.0 - 2018-11-21 ### Improvements - Load settings from environment variables @@ -154,7 +155,7 @@ All notable changes to this project will be documented in this file. - During DST transition, handle ambiguous dates as pre-transition -## 1.2.0 - 2018-10-20 +## v1.2.0 - 2018-10-20 ### Improvements - Content updates in the "Welcome" page. @@ -169,7 +170,7 @@ All notable changes to this project will be documented in this file. - Fix hamburger menu button in "Login" page. -## 1.1.0 - 2018-08-20 +## v1.1.0 - 2018-08-20 ### Improvements - A new "Check Details" page. diff --git a/hc/front/templatetags/hc_extras.py b/hc/front/templatetags/hc_extras.py index aaadc79f..5f1e31e9 100644 --- a/hc/front/templatetags/hc_extras.py +++ b/hc/front/templatetags/hc_extras.py @@ -40,6 +40,11 @@ def site_root(): return settings.SITE_ROOT +@register.simple_tag +def site_version(): + return settings.VERSION + + @register.simple_tag def debug_warning(): if settings.DEBUG: diff --git a/hc/settings.py b/hc/settings.py index b3ea6ad5..c485891b 100644 --- a/hc/settings.py +++ b/hc/settings.py @@ -34,6 +34,12 @@ DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL", "healthchecks@example.org") SUPPORT_EMAIL = os.getenv("SUPPORT_EMAIL") USE_PAYMENTS = envbool("USE_PAYMENTS", "False") REGISTRATION_OPEN = envbool("REGISTRATION_OPEN", "True") +VERSION = "" +for line in open(os.path.join(BASE_DIR, "CHANGELOG.md")).readlines(): + if line.startswith("## v"): + VERSION = line.split()[1] + break + INSTALLED_APPS = ( "django.contrib.admin", diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html new file mode 100644 index 00000000..56c6b93a --- /dev/null +++ b/templates/admin/base_site.html @@ -0,0 +1,11 @@ +{% extends "admin/base_site.html" %} +{% load hc_extras %} +{% block title %}{% site_name %} Administration{% endblock %} + +{% block branding %} +

+ {% site_name %} + {% site_version %} +

+{% endblock %} +