Skip to content
Snippets Groups Projects
Commit 59668649 authored by ynerant's avatar ynerant
Browse files

Aliases are case insensitive

parent 732f8bc3
No related branches found
No related tags found
1 merge request!8API & autocomplétion
Pipeline #7715 passed with stage
in 3 minutes and 1 second
...@@ -67,7 +67,7 @@ class NotePolymorphicViewSet(viewsets.ModelViewSet): ...@@ -67,7 +67,7 @@ class NotePolymorphicViewSet(viewsets.ModelViewSet):
queryset = Note.objects.all() queryset = Note.objects.all()
alias = self.request.query_params.get("alias", ".*") 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) note_type = self.request.query_params.get("type", None)
if note_type: if note_type:
...@@ -102,7 +102,7 @@ class AliasViewSet(viewsets.ModelViewSet): ...@@ -102,7 +102,7 @@ class AliasViewSet(viewsets.ModelViewSet):
queryset = Alias.objects.all() queryset = Alias.objects.all()
alias = self.request.query_params.get("alias", ".*") 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) note_id = self.request.query_params.get("note", None)
if note_id: if note_id:
......
...@@ -69,7 +69,7 @@ class NoteAutocomplete(autocomplete.Select2QuerySetView): ...@@ -69,7 +69,7 @@ class NoteAutocomplete(autocomplete.Select2QuerySetView):
# self.q est le paramètre de la recherche # self.q est le paramètre de la recherche
if self.q: 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) # Filtrage par type de note (user, club, special)
note_type = self.forwarded.get("note_type", None) note_type = self.forwarded.get("note_type", None)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment