Allow searching skill by notation

This commit is contained in:
Gregory Trullemans 2022-10-13 21:05:20 +02:00
parent 94da55e019
commit 9ae3147e4e
1 changed files with 3 additions and 1 deletions

View File

@ -32,7 +32,9 @@ def skill_lookup(request):
# Ignore queries shorter than length 2
if pattern is not None and len(pattern) > 2:
model_results = Skill.objects.filter(
Q(short_label__icontains=pattern) | Q(long_label__icontains=pattern)
Q(short_label__icontains=pattern)
| Q(long_label__icontains=pattern)
| Q(notation__icontains=pattern)
)
results = [
{"ID": x.id, "Name": str(x), "Notation": x.notation} for x in model_results