1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Aliases are case insensitive

This commit is contained in:
Yohann D'ANELLO 2020-02-08 23:49:39 +01:00
parent 732f8bc3d8
commit 596686497d
2 changed files with 3 additions and 3 deletions

View File

@ -67,7 +67,7 @@ class NotePolymorphicViewSet(viewsets.ModelViewSet):
queryset = Note.objects.all()
alias = self.request.query_params.get("alias", ".*")
queryset = queryset.filter(Q(alias__name__regex=alias) | Q(alias__normalized_name__regex=alias))
queryset = queryset.filter(Q(alias__name__regex=alias) | Q(alias__normalized_name__regex=alias.lower()))
note_type = self.request.query_params.get("type", None)
if note_type:
@ -102,7 +102,7 @@ class AliasViewSet(viewsets.ModelViewSet):
queryset = Alias.objects.all()
alias = self.request.query_params.get("alias", ".*")
queryset = queryset.filter(Q(name__regex=alias) | Q(normalized_name__regex=alias))
queryset = queryset.filter(Q(name__regex=alias) | Q(normalized_name__regex=alias.lower()))
note_id = self.request.query_params.get("note", None)
if note_id:

View File

@ -69,7 +69,7 @@ class NoteAutocomplete(autocomplete.Select2QuerySetView):
# self.q est le paramètre de la recherche
if self.q:
qs = qs.filter(Q(alias__name__regex=self.q) | Q(alias__normalized_name__regex=self.q))
qs = qs.filter(Q(alias__name__regex=self.q) | Q(alias__normalized_name__regex=self.q.lower()))
# Filtrage par type de note (user, club, special)
note_type = self.forwarded.get("note_type", None)