At the moment, our website uses the primary keys of
NewsLink objects in the URL patterns of related views. This practice is frowned upon, and we want to switch to using the
SlugField of the
NewsLink object, a field we added in Chapter 10: Revisiting Migrations.
The trick to our new URL patterns is that the
slug does not uniquely identify the
NewsLink object. Instead, the combination of
slug does. Our URL patterns thus need to use two slugs to identify the
NewsLink. That’s somewhat tricky. All of our pages simply use
slug as a variable name in regular expression patterns, and now we have to differentiate between
newslink_slug in some instances.
As these views will now be associated with ...