The ultimate way to adhere to DRY while generating links is to provide a
get_absolute_url() method to each model class, allowing for the quick retrieval of each model object’s canonical URL path.
Let’s focus on our
Tag model class first. To reverse a URL in Python, we need the
reverse() method, and so we start by importing it in Example 6.33.
1 from django.core.urlresolvers import reverse
We can then focus on creating the method. The
organizer_tag_detail URL pattern reads as in Example 6.34.