Guys,
I have the following code from some example i got from here, but its not working on my django application.
On my templete i have this function:
$(function(){ setAutoComplete("tags", "tagResults", "/taglookup/?query="); });
and on my urls i have the following line
(r'^taglookup/$', 'twine.twineapp.views.tag_lookup'),
and my view looks like this:
def tag_lookup(request):
# Default return list
results = []
if request.method == "GET":
if request.GET.has_key(u'query'):
value = request.GET[u'query']
# Ignore queries shorter than length 3
if len(value) > 2:
#model_results = Book.objects.filter(name__icontains=value)
TaggedItem = Tag.objects.get_by_model(Question, Tag.objects.filter(name__in=[value]))
results = [ x.name for x in TaggedItem]
json = simplejson.dumps(results)
return HttpResponse(json, mimetype='application/json')
When i try to type anything on my "tags" field in the template, firebug gives me the following error;
GET http://127.0.0.1:8000/taglookup/?query=test 404 NOT FOUND JQuery-1.3.2.js (line 3633)
Any ideas where am goofing?
Gath