jQuery Autocomplete with Remote JSON Source + Google App Engine + Python

前端 未结 2 399
逝去的感伤
逝去的感伤 2021-01-28 10:55

So let\'s say I have a webapp which just lets users save their hobbies. So I have Kind like this:

class Hobby(ndb.Model):
    hobby_name = ndb.StringProperty()
<         


        
相关标签:
2条回答
  • 2021-01-28 11:28

    search.php needs to be replaced with something like suggetsHobbies.php That file should return a list of hobbies that the auto-completion tool can use to build the list of hobbies that are suggested. It is given a parameter term that contains what the user has typed so far. Use that to restrict the list returned. F.ex. if term is "ba", return a list of hobbies beginning with "ba".

    0 讨论(0)
  • 2021-01-28 11:49

    I think you should look into Django packages for this type of behaviour.

    This page from djangopackages.com references several packages doing exactly what you want, and written for Django. I suggest you have a look at django-autocomplete-light (the doc is great), or django-selectable, which is more similar to your question's approach.

    0 讨论(0)
提交回复
热议问题