Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3957866
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:32:35+00:00 2026-05-20T02:32:35+00:00

Does anybody know how to implement the jQuery autocomplete plugin in Django, using databases

  • 0

Does anybody know how to implement the jQuery autocomplete plugin in Django, using databases instead of local values?

Specifically I want to implement the “Search Page Replacement” feature mentioned at bottom of the page, the dataset will be approx a thousand or more entries, but I cannot workout how to get it to interact with the necessary fields of my database.

(Am also on the lookout for a good Python/Django search solution to use for my site – which is just a very simple website.)

Thank you for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:32:36+00:00Added an answer on May 20, 2026 at 2:32 am

    I rencently did something with jQuery.autocomplete with one model.

    funcionality of seach city when user starts to write the name:

    according the jqueryui docs to make work the autocomplete you need an input like this:

    <input id="n" type="text" name="n"/>
    

    so, the javascript in my template to attach the lib to this input looks like:

    $(document).ready(function(){
         $( "input#n" ).autocomplete({
                                source: "{% url autocomplete_city %}",
                                minLength: 2
            });
    });
    

    to resolve that URL you have to write something like this in your urls.py

    urlpatterns = patterns('cities.views',
        url(r'^autocomplete_city/$', 'autocomplete_city', name='autocomplete_city'),
    )
    

    that mean that I have something like cities.views.autocomplete_city view:

    def autocomplete_city(request):
        term = request.GET.get('term') #jquery-ui.autocomplete parameter
        cities = City.objects.filter(name__istartswith=term) #lookup for a city
        res = []
        for c in cities:
             #make dict with the metadatas that jquery-ui.autocomple needs (the documentation is your friend)
             dict = {'id':c.id, 'label':c.__unicode__(), 'value':c.__unicode__()}
             res.append(dict)
        return HttpResponse(simplejson.dumps(res))
    

    what else de you need? start testing and remember DOCUMENTATIONS ARE YOUR FRIEND please TRY to make the things for yourself first, google it, read the docs, try 3 times, if cant, stackoverflow is your friend.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know how to implement cellular automata in Java or C#?
Hee Does anybody know how to implement an method in objective c that will
Does anybody know working thumbnail shell extension written in C# that works on winXP?
I have a problem using devise with an AJAX login. I'm using the :remote
I'm starting to create a user system for my website, and what I want
As most of us know, in order to manage memory well in .net it
I'm migrating our DAL class library to .NET 4 (from .NET 3.5). We're using
I'm trying to implement an arrow that uses the orientation sensor in order to
Im making an app similar to apples weather app. My main view has a
I'm writing an app and I need to change the view if the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.