On Thu, Apr 9, 2009 at 3:16 AM, Gath <pgath...@gmail.com> wrote:
>
>
> Guys,
>
> I have the following code from some example i got from
> here: 
> http://lethain.com/entry/2007/dec/01/using-jquery-django-autocomplete-fields,
>
> but its not working on my django application.
>
> On my templete i have this function:
>
> $(function(){ setAutoComplete("tags", "tagResults", "/taglookup/?
> query=");taglookup/?query=test 404 NOT FOUND });
>
> 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

The url for the view is r'^taglookup/$, meaning that the spacified url
should end with /$.In you case the complete url is:
taglookup/?query=test so, the regular expresion isn't corrert.

A quick fix should be to addd something like taglookup/.*

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to