python - jquery autocomplete tagging -
Can anyone tell me how to use auto-complete tagging in a Djgoone template?
I have done this in the Django address interface but I am confused about how to do this in a template.
Thank you in advance
I have this code in my template:
$ (document) .ready (function () {$ ("# tags1"). Autocomplete ("/ taglookup /", {width: 320, multiple: true, multipleSeparator: ""});}
And on my url.py this urlparttern is on tuple, it can be based on something you want to wipe ideas and URLs!
('R' ^ taglookup / $ ',' twine.twineapp.views.tag_lookup ')
And the tag_postup view has been applied to me at my views.py:
def tag_lookup (requested): # default usage The list result = [] If request.method == "GET": If request .GET.has_key (u'q '): VA Lue = request.GET [u'q'] # if LAN (value)> 2: TI = Tag.objects.filter (name__startswith = value.lower ()) = Return [x.name] for x in ti] HttpResponse ('\ n'.join (result), mime type =' text / plain ' )
PS: I am using the package, that is why I have a tag object in the above version.
Comments
Post a Comment