Opening object details in a modal dialog

In this recipe, we will create a list of links to the locations, which when clicked, opens a Bootstrap 3 modal dialog (we will call it pop up in this recipe) with some information about the location and the more… link leading to the location detail page. The content for the dialog will be loaded by Ajax. For visitors without JavaScript, the detail page will open immediately, without this intermediate step.

Getting ready

Let's start with the locations app that we created in the previous recipe.

In the urls.py file, we will have three URL rules; one for the location list, other for the location detail, and the third one for the dialog, as follows:

# locations/urls.py # -*- coding: UTF-8 -*- from __future__ import ...

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.