summaryrefslogtreecommitdiff
path: root/archaeological_operations/views.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-03-14 10:59:45 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-03-17 19:46:07 +0100
commit6ac04db98d7879c3406adfac868999300f7ce04e (patch)
tree03af2a33453c845975a57a116c3fde59fcf7b3a5 /archaeological_operations/views.py
parentfab8f18b037ebc2963092bf08b9980cab2a0d2ef (diff)
downloadIshtar-6ac04db98d7879c3406adfac868999300f7ce04e.tar.bz2
Ishtar-6ac04db98d7879c3406adfac868999300f7ce04e.zip
🩹 autocomplete operation: more tolerant search on code
Diffstat (limited to 'archaeological_operations/views.py')
-rw-r--r--archaeological_operations/views.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index e1ce1ea59..14d6edbe5 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -117,14 +117,9 @@ def autocomplete_operation(request):
extra = extra | Q(year=q) | Q(operation_code=q)
except ValueError:
pass
- if settings.COUNTRY == "fr":
- if q.startswith("OA"):
- q = q[2:]
- try:
- int(q)
- extra |= Q(code_patriarche__contains=q)
- except ValueError:
- pass
+ if settings.COUNTRY == "fr" and q.startswith("OA"):
+ q = q[2:]
+ extra |= Q(code_patriarche__contains=q)
query = query & extra
limit = 15
operations = models.Operation.objects.filter(query).distinct()[:limit]