From 6ac04db98d7879c3406adfac868999300f7ce04e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 14 Mar 2025 10:59:45 +0100 Subject: 🩹 autocomplete operation: more tolerant search on code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_operations/views.py | 11 +++-------- 1 file 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] -- cgit v1.2.3