From db729168d87a7ef8b8cc5b4c7b0b9d047236bc19 Mon Sep 17 00:00:00 2001 From: Ben Rometsch Date: Fri, 25 Jun 2021 11:46:05 +0100 Subject: [PATCH] Search on email address as well as Org name (#153) --- api/sales_dashboard/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/sales_dashboard/views.py b/api/sales_dashboard/views.py index a02bd6af16e3..36b85af7c76c 100644 --- a/api/sales_dashboard/views.py +++ b/api/sales_dashboard/views.py @@ -52,7 +52,9 @@ def get_queryset(self): if "search" in self.request.GET: search_term = self.request.GET["search"] - queryset = queryset.filter(name__icontains=search_term) + queryset = queryset.filter( + Q(name__icontains=search_term) | Q(users__email__icontains=search_term) + ) if self.request.GET.get("sort_field"): sort_field = self.request.GET["sort_field"]