#86 Autocomplete enhancement

* adds support for title lookup on EcoAccounts
* adds support for title lookup on Interventions
* adds support for email lookup on User
This commit is contained in:
mpeltriaux 2022-02-08 17:08:03 +01:00
parent 0afb4d34c3
commit 83531c5f77

View File

@ -35,8 +35,9 @@ class EcoAccountAutocomplete(Select2QuerySetView):
)
if self.q:
qs = qs.filter(
identifier__icontains=self.q
)
Q(identifier__icontains=self.q) |
Q(title__icontains=self.q)
).distinct()
return qs
@ -57,8 +58,9 @@ class InterventionAutocomplete(Select2QuerySetView):
)
if self.q:
qs = qs.filter(
identifier__icontains=self.q
)
Q(identifier__icontains=self.q) |
Q(title__icontains=self.q)
).distinct()
return qs
@ -81,8 +83,9 @@ class ShareUserAutocomplete(Select2QuerySetView):
if self.q:
# Due to privacy concerns only a full username match will return the proper user entry
qs = qs.filter(
username=self.q
)
Q(username=self.q) |
Q(email=self.q)
).distinct()
return qs