I have a wishlist system. By this, user can add items to wishlist by clicking on heart icon, the problem is that i have two places where user can remove the items from wishlist:
1. User can remove items on the wishlis from the search results
2. User can remove items on the wishlis from "Wishlist" menu
So by this, how to redirect based on page for example,
1, When user reclicks heart icon on search results it do action and redirect to same search result page
2, And when user reclicks heart icon on wishlist menu it should redirect back to wishlist again
Here is the code
def save_wish(request, pk):
if request.method == 'POST':
student = request.user.student
.........
.........
return redirect('students:search')
So the above code always returns to "search" irrespective the page user clicked, how to conditional redirect to "Search" when user clicks from search and to "wishlist" when user clicks from "wishlist" page?