1π
β
The title in the URL is part of the pattern, which may or may not be matched against the document slug in the view.
Something like:
url(r'^guideline/(?P<id>\d+)/(?P<slug>[-\w]+)/$', perma_post, name="cv_perma")
Then you could look for an object with both id and slug, or just the id and redirect to the correct URL if the slug does not match -which is what Stackoverflow does.
π€jminuscula
Source:stackexchange.com