Meilleur test has_nonENS_mail

This commit is contained in:
Robin Champenois 2021-01-24 23:42:13 +01:00
parent 90aa558896
commit 9004c802eb

View file

@ -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):