Hello everyone! Currently I am working on Django.
I defined a 'Search' function in views.py: def search(request): q = request.GET.get("q") if q: ReactResul = Reactionsmeta.objects.filter(id__contains=q) MetaResul = Metabolites.objects.filter(id__contains=q) GeneResul = Genes.objects.filter(id__contains=q) else: # you may want to return Customer.objects.none() instead ReactResul= Reactionsmeta.objects.all() GeneResul = Genes.objects.all() MetaResul = Metabolites.objects.all() context = dict(result_1=MetaResul, q=q, result_2=ReactResul, result_3 = GeneResul) return render(request, "Recon/search.html", context) And now I want to make it more powerful. If I want to search '10FTH86RSK' but I cannot remember the whole name, I can just use part of the string to make query. For example, if I type '10FTK', '10FTH86RSK' should be returned as result. In that case, '10FTK', '10F6TK' or '10FTK4' should also be returned as results. So how could I achieve this function? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/793b8999-cac4-4c2d-94cc-eabb80f4e702%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.