Attaching your own navigation

Once you have an app hooked in the CMS pages, all the URL paths under the page node will be controlled by the urls.py file of the app. To add some menu items under this page, you need to add a dynamical branch of navigation to the page tree. In this recipe, we will improve the movies app and add new navigation items under the Movies page.

Getting ready

Let's say that we have a URL configuration for different lists of movies: editor's picks, commercial movies, and independent movies, as shown in the following code:

# movies/urls.py # -*- coding: UTF-8 -*- from __future__ import unicode_literals from django.conf.urls import url, patterns from django.shortcuts import redirect urlpatterns = patterns("movies.views", url(r"^$", ...

Get Web Development with Django Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.