I am trying to learn Django by following the tutorial in the old Django book, and I'm currently stuck with a jquery ui autocomplete implementation for a single field in my application. I searched a lot for this problem just to confuse me. So here is this code.
urls.py
`(r'^ajax/tag/autocomplete/$', ajax_tag_autocomplete),`
tag_autocomplete.js
$(document).ready(function () { $("#id_tags").autocomplete({ source: "/ajax/tag/autocomplete/", }); });
views.py
def ajax_tag_autocomplete(request): if 'term' in request.GET: tags = Tag.objects.filter( name__istartswith=request.GET['term'] )[:10] return HttpResponse(u'\n'.join(tag.name for tag in tags)) return HttpResponse()
Therefore, when I browse my application and start typing characters in this tag field, I donβt see anything, the list is not displayed. However, firebug shows me that the code is executing the request and returning the correct result. What simple thing am I missing?
source share