From c963e245891267a854da0fa30fddebbe8b8cd51e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <gitlab@cmatte.me>
Date: Wed, 19 Jan 2022 10:44:22 +0100
Subject: [PATCH 1/4] Add context processor to define organization info

This patch adds a new context processor PGListerContextProcessor that imports
organization infos (name and motto) defined in settings.py
---
 web/pglister/contexts.py | 9 +++++++++
 web/pglister/settings.py | 6 ++++++
 2 files changed, 15 insertions(+)
 create mode 100644 web/pglister/contexts.py

diff --git a/web/pglister/contexts.py b/web/pglister/contexts.py
new file mode 100644
index 0000000..5e310ff
--- /dev/null
+++ b/web/pglister/contexts.py
@@ -0,0 +1,9 @@
+from django.conf import settings
+
+
+# Template context processor to add information about organization name
+# and motto defined in settings.py
+def PGListerContextProcessor(request):
+    return {
+        'organization_info': settings.ORGANIZATION_INFO,
+    }
diff --git a/web/pglister/settings.py b/web/pglister/settings.py
index 122768d..da9d7df 100644
--- a/web/pglister/settings.py
+++ b/web/pglister/settings.py
@@ -70,6 +70,7 @@ TEMPLATES = [
                 'django.template.context_processors.request',
                 'django.contrib.auth.context_processors.auth',
                 'django.contrib.messages.context_processors.messages',
+                'pglister.contexts.PGListerContextProcessor',
             ],
             'loaders': [
                 'django.template.loaders.filesystem.Loader',
@@ -115,6 +116,11 @@ DATETIME_FORMAT = "Y-m-d H:i:s"
 
 STATIC_URL = '/media/'
 
+ORGANIZATION_INFO = {
+    'name': 'PostgreSQL',
+    'motto': "The world's most advanced open source database"
+}
+
 # Override in local settings
 USE_PG_COMMUNITY_AUTH = True  # Right now we *always* do, but this is used to turn on/off some local features
 PGAUTH_REDIRECT = "http://localhost:8000/account/auth/12/"
-- 
2.34.1

