I have this method in my book model:
def get_absolute_url(self):
return "/book/%s/%s/%i/%i/" % ( self.book_title, self.book_editor, self.book_pages, self.id)
So the urls of each book are like this:
example.com/book/the-bible/gesu-crist/938/12/
I want that if there is an error in the url, then I get redirected to the real url by using book.id in the end of the url.
For example if I go to:
example.com/book/A-bible/gesu-crist/938/12/
the I will get redirected to:
example.com/book/the-bible/gesu-crist/938/12/
How can I do that ?