I have a situation which I hope you can help me. I have read a few post and answers about getting current url path on SO current_url and url TEMPLATE_CONTEXT_PROCESSORS (which are most relevant). But it doesn't seem to fit what I am trying to do. I have a view:
def fish_search(request):
args = {}
#irrelevant code here
args['fishes'] = fishes
args['current_path'] = request.get_full_path()
return render_to_response('ajax_search.html', args)
In my ajax_search.html:
<a id="search-results" href="{{ current_path }}"></a>
And base.html:
div id="search-results" ></div>
Javascript dumps the search results to base.html. And base.html is extended in fishMarket.html, fishDictionary.html, fishRumour.html, etc. So, sadly, the paths that show up are all "/search/"
I want the path to be /fishMarket/ if I am searching from fishMarket.html, /fishDictionary/ should show up if I am searching from fishDictionary.html, and likewise, /fishRumour/ if I am searching from fishRumour.html. Have anyone come across this type of situation? How did you solve this problem? I'm relatively new to django, so please dumb down the solution.
I really appreciate your help. many thanks!