6.4.1 Using url to Create Detail Page Links

Let’s pretend for a moment that we don’t know about get_absolute_url() and that we’re going to stick to using the url template tag directly.

All of our detail pages are dynamic pages with at least one regular expression named group. To reverse a URL pattern with such regular expressions, we saw earlier that we could treat the regular expression pattern like a template and pass the value we want to fill in the character set directly to either reverse() or the url template tag.

6.4.1.1 Using url with Tag Detail

The URL pattern organizer_tag_detail currently reads as shown in Example 6.23.

Example 6.23: Project Code

organizer/urls.py in 0a66a80be9

17    url(r'^tag/(?P<slug>[\w\-]+)/$' ...

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.