Now this works fine if he is in the details page e.g. as per the url /projects/4 . It works as expected, I am able to add to the table and it redirects back to the same page.
However, since this is something which I can call from any place, it fails in the sense that it gets redirected back to the project details page. E.g. I have a listing of projects, on /projects/ , i click the interested button, it unfortunately instead of going back to /projects/ goes to /projects/<project_id>
The code in my template file which calls this :
<a class="label label-default" href="{% url "project.views.add_interested_project" p.project.id %}"><span class="glyphicon glyphicon-heart"></span> Interested </a>
The relevant urls.py hookup :
url(r'^(?P<project_id>\d+)/add_interested_project$', views.add_interested_project, name="interestedProjects"),
The solution seems apparent that I should just pass the current URL to the view so that I can do a redirect back to it - but I am not able to get an example of how to actually implement it.
Regards,
Vibhu
--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius