From 25f965c750449b5c5e6473739df3d71ccca45e5b Mon Sep 17 00:00:00 2001 From: Robin Champenois Date: Sun, 29 Aug 2021 14:00:27 +0200 Subject: [PATCH] debug search --- avisstage/views_search.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/avisstage/views_search.py b/avisstage/views_search.py index 2c62d6b..b77c0de 100644 --- a/avisstage/views_search.py +++ b/avisstage/views_search.py @@ -147,11 +147,11 @@ def cherche(**kwargs): # Dates if field_relevant("avant_annee", False): - dte = date(kwargs["avant_annee"] + 1, 1, 1) + dte = date(min(2100, kwargs["avant_annee"]) + 1, 1, 1) filtres &= Q(date_fin__lt=dte) if field_relevant("apres_annee", False): - dte = date(kwargs["apres_annee"], 1, 1) + dte = date(max(2000, kwargs["apres_annee"]), 1, 1) filtres &= Q(date_debut__gte=dte) # Type de stage @@ -187,6 +187,8 @@ def cherche(**kwargs): ) else: resultat = resultat.order_by(tri) + else: + resultat = resultat.order_by(tri) return resultat, tri