1
Fork 0

Add actual pages to navbar

This commit is contained in:
Jake Howard 2018-07-26 09:22:19 +01:00
parent 739c870a69
commit 842ccae297
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 15 additions and 7 deletions

View file

@ -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()
}

View file

@ -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'
],
},
},

View file

@ -5,11 +5,13 @@
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a href="/" class="nav-link">
<code>~/something</code>
</a>
</li>
{% for child in homepage.get_children.specific %}
<li class="nav-item">
<a href="{{ child.url }}" class="nav-link">
<code>~/{{ child.slug }}</code>
</a>
</li>
{% endfor %}
</ul>
<div class="d-none d-lg-block">