From a1e1667a36438955dff231ea426f4a0fb9d02899 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 29 Jun 2021 16:13:19 +1000 Subject: [PATCH] Allow for overriding title This simply adds a global template variable taken from LODGEIT_TITLE_OVERRIDE that allows setting the site title for some minimal customisation. Previously, the opendev puppet would copy a custom layout.html over the shipped version. This allows us to simply set a variable and not have duplicate copies of templates in config managment. Change-Id: If25dcece0ecd2b7dfc0178c6886559ac2507b28f --- README | 6 ++++++ lodgeit/utils.py | 3 +++ lodgeit/views/layout.html | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README b/README index f1b6cda..d7a4431 100644 --- a/README +++ b/README @@ -64,3 +64,9 @@ Now start the development server:: python manage.py runserver Enjoy! + +Environment Settings +==================== + +LODGEIT_TITLE_OVERRIDE : + Arbitrary string to override the main heading for site customisation diff --git a/lodgeit/utils.py b/lodgeit/utils.py index 6ef3480..0031901 100644 --- a/lodgeit/utils.py +++ b/lodgeit/utils.py @@ -8,6 +8,7 @@ :license: BSD """ import base64 +import os import re import time from os import path @@ -45,6 +46,8 @@ def url_for(endpoint, external=False, **values): jinja_environment.globals['url_for'] = url_for +jinja_environment.globals['title'] = \ + os.getenv('LODGEIT_TITLE_OVERRIDE', 'Lodge It') def generate_user_hash(): diff --git a/lodgeit/views/layout.html b/lodgeit/views/layout.html index dfecbed..a63e6c3 100644 --- a/lodgeit/views/layout.html +++ b/lodgeit/views/layout.html @@ -18,7 +18,7 @@