From ec980634ed10eb96359cdc567e0a22b520e8daac Mon Sep 17 00:00:00 2001 From: Nanoy Date: Wed, 23 Jan 2019 12:31:33 +0100 Subject: [PATCH] contains devient icontains --- CHANGELOG.md | 2 ++ gestion/views.py | 10 +++++----- templates/footer.html | 2 +- users/views.py | 10 +++++----- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 734e76d..60384da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## v3.3.1 +* contains devient icontains pour enlever la sensibilité à la casse ## v3.3.0 * Ajout d'icônes * Le . est utilisé pour les décimaux diff --git a/gestion/views.py b/gestion/views.py index fe76b11..ff9fbd2 100644 --- a/gestion/views.py +++ b/gestion/views.py @@ -532,7 +532,7 @@ class ProductsAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = Product.objects.all() if self.q: - qs = qs.filter(name__contains=self.q) + qs = qs.filter(name__icontains=self.q) return qs class ActiveProductsAutocomplete(autocomplete.Select2QuerySetView): @@ -542,7 +542,7 @@ class ActiveProductsAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = Product.objects.filter(is_active=True) if self.q: - qs = qs.filter(name__contains=self.q) + qs = qs.filter(name__icontains=self.q) return qs ########## Kegs ########## @@ -790,7 +790,7 @@ class KegActiveAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = Keg.objects.filter(is_active = True) if self.q: - qs = qs.filter(name__contains=self.q) + qs = qs.filter(name__icontains=self.q) return qs class KegPositiveAutocomplete(autocomplete.Select2QuerySetView): @@ -800,7 +800,7 @@ class KegPositiveAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = Keg.objects.filter(stockHold__gt = 0) if self.q: - qs = qs.filter(name__contains=self.q) + qs = qs.filter(name__icontains=self.q) return qs ########## Menus ########## @@ -957,7 +957,7 @@ class MenusAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = Menu.objects.all() if self.q: - qs = qs.filter(name__contains=self.q) + qs = qs.filter(name__icontains=self.q) return qs ########## Ranking ########## diff --git a/templates/footer.html b/templates/footer.html index cca478e..f444a7d 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -39,6 +39,6 @@
  • Facebook
  • - + diff --git a/users/views.py b/users/views.py index a2c3a0c..c2ce219 100644 --- a/users/views.py +++ b/users/views.py @@ -1079,7 +1079,7 @@ class AllUsersAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = User.objects.all() if self.q: - qs = qs.filter(Q(username__contains=self.q) | Q(first_name__contains=self.q) | Q(last_name__contains=self.q)) + qs = qs.filter(Q(username__icontains=self.q) | Q(first_name__icontains=self.q) | Q(last_name__icontains=self.q)) return qs class ActiveUsersAutocomplete(autocomplete.Select2QuerySetView): @@ -1089,7 +1089,7 @@ class ActiveUsersAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = User.objects.filter(is_active=True) if self.q: - qs = qs.filter(Q(username__contains=self.q) | Q(first_name__contains=self.q) | Q(last_name__contains=self.q)) + qs = qs.filter(Q(username__icontains=self.q) | Q(first_name__icontains=self.q) | Q(last_name__icontains=self.q)) return qs class AdherentAutocomplete(autocomplete.Select2QuerySetView): @@ -1101,7 +1101,7 @@ class AdherentAutocomplete(autocomplete.Select2QuerySetView): pks = [x.pk for x in qs if x.is_adherent] qs = User.objects.filter(pk__in=pks) if self.q: - qs = qs.filter(Q(username__contains=self.q) | Q(first_name__contains=self.q) | Q(last_name__contains=self.q)) + qs = qs.filter(Q(username__icontains=self.q) | Q(first_name__icontains=self.q) | Q(last_name__icontains=self.q)) return qs @@ -1112,7 +1112,7 @@ class NonSuperUserAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = User.objects.filter(is_superuser=False) if self.q: - qs = qs.filter(Q(username__contains=self.q) | Q(first_name__contains=self.q) | Q(last_name__contains=self.q)) + qs = qs.filter(Q(username__icontains=self.q) | Q(first_name__icontains=self.q) | Q(last_name__icontains=self.q)) return qs class NonAdminUserAutocomplete(autocomplete.Select2QuerySetView): @@ -1122,5 +1122,5 @@ class NonAdminUserAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): qs = User.objects.filter(is_staff=False) if self.q: - qs = qs.filter(Q(username__contains=self.q) | Q(first_name__contains=self.q) | Q(last_name__contains=self.q)) + qs = qs.filter(Q(username__icontains=self.q) | Q(first_name__icontains=self.q) | Q(last_name__icontains=self.q)) return qs \ No newline at end of file