Python Autocomplete Internal 500 error

I’m using a Python autocomplete plugin from 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

“global name ‘HttpResponse’ is not defined”

Error copied from Firebug:


Here is my html:

{% 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 200 is reporting “global name ‘HttpResponse’ is not defined”):

def ajax_tag_autocomplete(request):
	if 'q' in request.GET:
		tags = Tag.objects.filter(
200.		return HttpResponse(u'\
'.join( for tag in tags))
	return HttpResponse()

Here is a snippet from my

# Ajax
(r'^ajax/tag/autocomplete/$', ajax_tag_autocomplete),

Here is a snippet from my tag_autocomplete.js file:

$(document).ready(function () {
		{multiple: true, multipleSeparator: ' '}

I have a feeling it’s something very obvious that I’m overlooking.


enable Django’s debug and you’ll get details debug information via Firebug

Looks like you’re missing

from django.http import HttpResponse

in your

THANK YOU! I knew it was something obvious like that. Works like a charm now. :rofl::lol::rofl::lol::rofl: