Match substrings, not just prefixes, in autocompletion

newer-dal
LEdoian 4 years ago
parent 2fe939460b
commit 1e3db9b7b5

@ -8,7 +8,7 @@ class WishListAutocomplete(autocomplete.Select2QuerySetView):
qs = WishList.objects.all().filter(owner=self.request.user) qs = WishList.objects.all().filter(owner=self.request.user)
if self.q: if self.q:
qs = qs.filter(name__startswith=self.q) qs = qs.filter(name__icontains=self.q)
return qs return qs

Loading…
Cancel
Save