From 84889388c9bec59ec1dfd7007d2d86dddfe03cd3 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sat, 5 Jan 2019 20:11:36 +0100 Subject: [PATCH] Avoid crash when 'email' field is not here --- users/models.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/users/models.py b/users/models.py index c5287fb6..a2798207 100755 --- a/users/models.py +++ b/users/models.py @@ -1026,17 +1026,12 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, ): raise ValidationError("This pseudo is already in use.") if not self.local_email_enabled and not self.email and not (self.state == self.STATE_ARCHIVE): - raise ValidationError( - {'email': ( - _("There is neither a local email address nor an external" + raise ValidationError(_("There is neither a local email address nor an external" " email address for this user.") - ), } ) if self.local_email_redirect and not self.email: - raise ValidationError( - {'local_email_redirect': ( - _("You can't redirect your local emails if no external email" - " address has been set.")), } + raise ValidationError(_("You can't redirect your local emails if no external email" + " address has been set.") ) def __str__(self):