From 7848cd9cc2704d9257bc41fdb0b143918e009c19 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Thu, 7 Oct 2021 13:15:52 +0200 Subject: [PATCH] Don't search buttons by prefix Signed-off-by: Yohann D'ANELLO --- apps/note/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/note/views.py b/apps/note/views.py index 074da01d..1224f2f8 100644 --- a/apps/note/views.py +++ b/apps/note/views.py @@ -90,9 +90,9 @@ class TransactionTemplateListView(ProtectQuerysetMixin, LoginRequiredMixin, Sing if "search" in self.request.GET: pattern = self.request.GET["search"] qs = qs.filter( - Q(name__iregex="^" + pattern) - | Q(destination__club__name__iregex="^" + pattern) - | Q(category__name__iregex="^" + pattern) + Q(name__iregex=pattern) + | Q(destination__club__name__iregex=pattern) + | Q(category__name__iregex=pattern) | Q(description__iregex=pattern) )