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',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.flatpages',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.sites',
@ -71,6 +72,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
]
ROOT_URLCONF = 'ojusomap.urls'

View File

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

View File

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