mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-22 15:32:22 +00:00
Better alias research, closes #51
This commit is contained in:
parent
fd705adb05
commit
9008baad3a
@ -106,7 +106,10 @@ class ConsumerViewSet(ReadOnlyProtectedModelViewSet):
|
||||
queryset = super().get_queryset()
|
||||
|
||||
alias = self.request.query_params.get("alias", ".*")
|
||||
queryset = queryset.filter(normalized_name__iregex="^" + Alias.normalize(alias))\
|
||||
queryset = queryset.filter(
|
||||
Q(name__regex="^" + alias)
|
||||
| Q(normalized_name__regex="^" + Alias.normalize(alias))
|
||||
| Q(normalized_name__regex="^" + alias.lower()))\
|
||||
.order_by('name').prefetch_related('note')
|
||||
|
||||
return queryset
|
||||
|
Loading…
Reference in New Issue
Block a user