def clean_email(self):
        email = self.cleaned_data["email"]
        try:
            get_user_model()._default_manager.get(email=email)
        except get_user_model().DoesNotExist:
            return email
        raise forms.ValidationError(self.error_messages['duplicate_email'])
Set a nicer error message than the ORM.
dataset/ETHPy150Open fabric-bolt/fabric-bolt/fabric_bolt/accounts/forms.py/UserCreationForm.clean_email