From 842ccae29760577bd8a7ac37178e5323598921ff Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 26 Jul 2018 09:22:19 +0100 Subject: [PATCH] Add actual pages to navbar --- project/common/context.py | 7 ++++++- project/settings.py | 3 ++- templates/common/navbar.html | 12 +++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/project/common/context.py b/project/common/context.py index c195715..32e1fc1 100644 --- a/project/common/context.py +++ b/project/common/context.py @@ -1,5 +1,5 @@ from django.conf import settings - +from project.home.models import HomePage SETTINGS_KEYS = [ 'BASE_URL', @@ -16,3 +16,8 @@ def settings_injector(request): return {'settings': { setting: getattr(settings, setting) for setting in SETTINGS_KEYS }} + +def get_home_page(request): + return { + 'homepage': HomePage.objects.live().first() + } diff --git a/project/settings.py b/project/settings.py index b5f58e5..4b3191d 100644 --- a/project/settings.py +++ b/project/settings.py @@ -102,7 +102,8 @@ TEMPLATES = [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', - 'project.common.context.settings_injector' + 'project.common.context.settings_injector', + 'project.common.context.get_home_page' ], }, }, diff --git a/templates/common/navbar.html b/templates/common/navbar.html index e63cc31..1c891aa 100644 --- a/templates/common/navbar.html +++ b/templates/common/navbar.html @@ -5,11 +5,13 @@