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.
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 unicode_literals
from django.conf.urls import patterns, url
urlpatterns = patterns("locations.views",
url(r"^$", "location_list", name="location_list"),
url(r"^(?P<slug>[^/]+)/$", "location_detail",
name="location_detail...