Add actual pages to navbar
This commit is contained in:
parent
739c870a69
commit
842ccae297
3 changed files with 15 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from project.home.models import HomePage
|
||||||
|
|
||||||
SETTINGS_KEYS = [
|
SETTINGS_KEYS = [
|
||||||
'BASE_URL',
|
'BASE_URL',
|
||||||
|
@ -16,3 +16,8 @@ def settings_injector(request):
|
||||||
return {'settings': {
|
return {'settings': {
|
||||||
setting: getattr(settings, setting) for setting in SETTINGS_KEYS
|
setting: getattr(settings, setting) for setting in SETTINGS_KEYS
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
def get_home_page(request):
|
||||||
|
return {
|
||||||
|
'homepage': HomePage.objects.live().first()
|
||||||
|
}
|
||||||
|
|
|
@ -102,7 +102,8 @@ TEMPLATES = [
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
'project.common.context.settings_injector'
|
'project.common.context.settings_injector',
|
||||||
|
'project.common.context.get_home_page'
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,11 +5,13 @@
|
||||||
</button>
|
</button>
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item">
|
{% for child in homepage.get_children.specific %}
|
||||||
<a href="/" class="nav-link">
|
<li class="nav-item">
|
||||||
<code>~/something</code>
|
<a href="{{ child.url }}" class="nav-link">
|
||||||
</a>
|
<code>~/{{ child.slug }}</code>
|
||||||
</li>
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="d-none d-lg-block">
|
<div class="d-none d-lg-block">
|
||||||
|
|
Reference in a new issue