user_management/models/admin_forms.py
def clean_email(self):
        """
        Since User.email is unique, this check is redundant,
        but it sets a nicer error message than the ORM. See #13147.
        """
        email = self.cleaned_data['email']
        try:
            User._default_manager.get(email__iexact=email)
        except User.DoesNotExist:
            return email.lower()
        raise forms.ValidationError(self.error_messages['duplicate_email'])
def clean_email(self):
        """
        Since User.email is unique, this check is redundant,
        but it sets a nicer error message than the ORM. See #13147.
        """
        email = self.cleaned_data['email']
        try:
            User._default_manager.get(email__iexact=email)
        except User.DoesNotExist:
            return email.lower()
        raise forms.ValidationError(self.error_messages['duplicate_email'])
def clean_email ( self ) : email = self . cleaned_data [ 'email' ] try : User . _default_manager . get ( email__iexact = email ) except User . DoesNotExist : return email . lower ( ) raise forms . ValidationError ( self . error_messages [ 'duplicate_email' ] )
Since User.email is unique, this check is redundant,
        but it sets a nicer error message than the ORM. See #13147.
Since User . email is unique this check is redundant but it sets a nicer error message than the ORM . See #13147 .