From 3f543d315463cc0f3a04cab5f9d05db1423a19a7 Mon Sep 17 00:00:00 2001 From: Eric Mc Sween Date: Tue, 22 Jul 2014 16:51:15 -0400 Subject: [PATCH] =?utf8?q?Fix:=20plantage=20caus=C3=A9=20par=20un=20employ=C3?= =?utf8?q?=A9=20sans=20dossier?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/rh/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/project/rh/models.py b/project/rh/models.py index 3c7a538..6fee112 100644 --- a/project/rh/models.py +++ b/project/rh/models.py @@ -562,7 +562,10 @@ class Employe(models.Model): # Retourne en le premier du queryset si la date de fin est None # Sinon, retourne le plus récent selon la date de fin. - first = res[0] + try: + first = res[0] + except IndexError: + return None if first.date_fin == None: return first else: -- 1.7.10.4