From 9004c802eb784dd0bf044e8e0cee4f1343bb5b80 Mon Sep 17 00:00:00 2001 From: Robin Champenois Date: Sun, 24 Jan 2021 23:42:13 +0100 Subject: [PATCH] Meilleur test has_nonENS_mail --- avisstage/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/avisstage/models.py b/avisstage/models.py index 7588207..33661f8 100644 --- a/avisstage/models.py +++ b/avisstage/models.py @@ -53,9 +53,12 @@ class Normalien(models.Model): return self.stages.filter(public=True).order_by('-date_debut') def has_nonENS_email(self): - return not ( - is_email_ens(self.mail, True) - and is_email_ens(self.user.email, True) + return ( + self.user.email_address_set + .exclude(confirmed_at__isnull=True) + .exclude(email__endswith="ens.fr") + .exclude(email__endswith="ens.psl.eu") + .exists() ) def nom_complet(self):