O'Reilly logo

Django Unleashed by Andrew Pinkham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

14.5 Pagination of Tag List Webpage Using the URL Path

Our goal in this section is to paginate the tag list webpage. Instead of using the query part of the URL, we pass the page number to the path part of the URL. This means that, instead of using request.GET to get the information about the query information, we must get it from the URL configuration (just as we get slug information).

Now we are left with a choice. We could create two URL patterns: one to match /tag/ and one to match /tag/2/. Or we could try to use a single URL pattern for both of those URL paths.

As it turns out, we will need to use two URL patterns. We start by trying to use a single regular expression pattern to match both URL path possibilities and discover why we need ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required