From f8a4087e56f45a282471a1ab9e89ea08a741e2e9 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 3 Aug 2020 11:32:37 +0200 Subject: [PATCH] :bug: Display full registration table when the search bar is empty --- apps/registration/views.py | 2 -- apps/wei/views.py | 14 ++++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/apps/registration/views.py b/apps/registration/views.py index 804c9fa9..f4574b0f 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -179,8 +179,6 @@ class FutureUserListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableVi | Q(profile__section__iregex=pattern) | Q(username__iregex="^" + pattern) ) - else: - qs = qs.none() return qs[:20] diff --git a/apps/wei/views.py b/apps/wei/views.py index 2210a347..fb0f7b32 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -236,14 +236,12 @@ class WEIRegistrationsView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTable pattern = self.request.GET.get("search", "") if not pattern: - return qs.none() - - qs = qs.filter( - Q(user__first_name__iregex=pattern) - | Q(user__last_name__iregex=pattern) - | Q(user__note__alias__name__iregex="^" + pattern) - | Q(user__note__alias__normalized_name__iregex="^" + Alias.normalize(pattern)) - ) + qs = qs.filter( + Q(user__first_name__iregex=pattern) + | Q(user__last_name__iregex=pattern) + | Q(user__note__alias__name__iregex="^" + pattern) + | Q(user__note__alias__normalized_name__iregex="^" + Alias.normalize(pattern)) + ) return qs[:20]