5.4 Building Tag Detail Webpage

To reinforce what we already know and expand our knowledge of URL patterns, we now create a second webpage. Our webpage will display the information for a single Tag object. We call our function view tag_detail(). Let’s begin by adding a URL pattern.

In Chapter 3, we specifically added SlugField to our Tag model to allow for the simple creation of unique URLs. We intend to use it now for our URL pattern. We want the request for /tag/django/ to show the webpage for the django Tag and the request for /tag/web/ to show the webpage for the web Tag.

This is the first gap in our knowledge. How can we get a single URL pattern to recognize both /tag/django/ and /tag/web/? The second gap in our knowledge is that we have ...

Get Django Unleashed 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.