From 54336352e2158eadba089c580a541723b5caa686 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Wed, 7 Oct 2020 16:49:13 +0200 Subject: [PATCH] Fixed email change form --- rowers/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rowers/models.py b/rowers/models.py index 8e1a53b2..0471b72f 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -3724,8 +3724,8 @@ class UserForm(ModelForm): 'Please enter a valid email address') try: - match = User.objects.filter(email__iexact=email) - if self.instance in match: + match = User.objects.filter(email__iexact=email).exclude(id=self.instance.id) + if match.count() == 0: return email except User.DoesNotExist: return email