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 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()
|
||||
}
|
||||
|
|
|
@ -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'
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -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">
|
||||
|
|
Reference in a new issue