From 1e3db9b7b5eaa71f7375079bec976a047ca95c3c Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Sat, 20 Feb 2021 07:22:17 +0100 Subject: [PATCH] Match substrings, not just prefixes, in autocompletion --- wishlist/views_autocomplete.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wishlist/views_autocomplete.py b/wishlist/views_autocomplete.py index 7bc080a..260c4bd 100644 --- a/wishlist/views_autocomplete.py +++ b/wishlist/views_autocomplete.py @@ -8,7 +8,7 @@ class WishListAutocomplete(autocomplete.Select2QuerySetView): qs = WishList.objects.all().filter(owner=self.request.user) if self.q: - qs = qs.filter(name__startswith=self.q) + qs = qs.filter(name__icontains=self.q) return qs