Add flatpages to apps and dynamic navbar listing

This commit is contained in:
Livvy Mackintosh 2017-10-09 17:37:33 +01:00
parent 00cc417f21
commit 38e8800cf2
3 changed files with 15 additions and 11 deletions

View File

@ -42,6 +42,7 @@ INSTALLED_APPS = [
'registration', 'registration',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.flatpages',
'django.contrib.humanize', 'django.contrib.humanize',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.sites', 'django.contrib.sites',
@ -71,6 +72,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
] ]
ROOT_URLCONF = 'ojusomap.urls' ROOT_URLCONF = 'ojusomap.urls'

View File

@ -1,4 +1,5 @@
{% spaceless %} {% spaceless %}
{% load flatpages %}
{% load i18n %} {% load i18n %}
{% load leaflet_tags %} {% load leaflet_tags %}
{% load static %} {% load static %}
@ -30,18 +31,13 @@
</button> </button>
<div class="collapse navbar-collapse" id="navbarNav"> <div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item active"> <li class="nav-item">
<a class="nav-link" href="#">Map <span class="sr-only">(current)</span></a> <a class="nav-link" href="#">Map <span class="sr-only">(current)</span></a>
</li> </li>
<li class="nav-item"> {% get_flatpages as flatpages %}
<a class="nav-link" href="#">Policy</a> {% for page in flatpages %}
</li> <li class="nav-item"><a class="nav-link" href="{{page.url}}">{{page.title}}</a></li>
<li class="nav-item"> {% endfor %}
<a class="nav-link" href="#">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">FAQ</a>
</li>
</ul> </ul>
</div> </div>
{% if user.is_authenticated %} {% if user.is_authenticated %}
@ -53,7 +49,8 @@
{% endif %} {% endif %}
</nav> </nav>
{% block body %}{% endblock %} {% block content %}
{% endblock %}
</body> </body>
{# CDN Javascript #} {# CDN Javascript #}

View File

@ -0,0 +1,5 @@
{% extends "base_page.html" %}
{% block content %}
{{flatpage.content}}
{% endblock %}