I'm trying to follow the examples given here: Refresh <div> element generated by a django template
But I end up with:
NoReverseMatch at /search/:
Reverse for '' with arguments '()' and keyword arguments
'{u'flights':[{FLIGHTS}]}' not found. 0 pattern(s) tried: []"
I see lots of search results for this error, but none of them seem relevant, unless I'm completely missing something.
Javascript in search.html: (UPDATED)
<script>
var flights = {{ flights | safe }}
$.ajax({
url: {% url 'search_results' flights %},
success: function(data) {
$('#search-results').html(data);
}
});
</script>
views.py:
def search_results(request, flights):
return render_to_response('search_results.html', flights)
urls.py: (UPDATED)
url(r'^search/search_results/(?P<flights>[^/]*)$', "fsApp.views.search_results", name='search_results'),
ETA:
I've now tried all of the following, and none work:
url(r'^search/(?P<flights>[^/]*)$', "fsApp.views.search_results", name='search_results'),
url(r'^search/search_results/(?P<flights>[^/]*)$', "fsApp.views.search_results", name='search_results'),
url(r'^search/(?P<flights>[^/]*)/search_results/$', "fsApp.views.search_results", name='search_results'),