I'm using a Python autocomplete plugin from bassistance.de but I'm receiving a 500 error when typing, instead of suggestions.
Firebug states a 500 while Python is reporting a name error at line 200 inside my views.py.
"global name 'HttpResponse' is not defined"
Error copied from Firebug:
Code:GET http://127.0.0.1:8000/ajax/tag/autocomplete/?q=test&limit=10×tamp=1262114752504 500 INTERNAL SERVER ERROR 95ms
Here is my html:
Here is a snippet from my views.py(line 200 is reporting "global name 'HttpResponse' is not defined"):Code:{% block external %} <link rel='stylesheet' type='text/css' href='/site_media/jquery.autocomplete.css' /> <script type='text/javascript' src='/site_media/jquery.autocomplete.js'></script> <script type='text/javascript' src='/site_media/tag_autocomplete.js'></script> <script type='text/javascript' src='/site_media/jquery.bgiframe.min.js'></script> {% endblock %}
Here is a snippet from my urls.py:Code:def ajax_tag_autocomplete(request): if 'q' in request.GET: tags = Tag.objects.filter( name__istartswith=request.GET['q'] )[:10] 200. return HttpResponse(u'\n'.join(tag.name for tag in tags)) return HttpResponse()
Here is a snippet from my tag_autocomplete.js file:Code:# Ajax (r'^ajax/tag/autocomplete/$', ajax_tag_autocomplete), )
I have a feeling it's something very obvious that I'm overlooking.Code:$(document).ready(function () { $("#id_tags").autocomplete( '/ajax/tag/autocomplete/', {multiple: true, multipleSeparator: ' '} ); });
Thanks.






Bookmarks