[Answered ]-How to redirect to an absolute url path in django?

1πŸ‘

βœ…

It will never access watchlist, since the <str:listing_title> will match for /watchlist. You should reorder the paths, and work with:

path('', views.index, name='index'),
path('watchlist', views.watchlist, name='watchlist'),
path('<str:listing_title>', views.listing, name='listing'),

Django will enumerate over all the URL patterns top-to-bottom, and "fire" the first view that has a matching URL pattern. If we thus put <str:listing_title> first, it will match watchlist with that <str:…> path part, and thus never trigger the listing.

Leave a comment