Created
November 23, 2016 17:06
-
-
Save mbmohib/900d71e53af1390ae22b55e9ad5bd782 to your computer and use it in GitHub Desktop.
In registration menu, checking email already exist or not!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def clean_email(self): | |
email = self.cleaned_data.get('email') | |
username = self.cleaned_data.get('username') | |
if email and User.objects.filter( | |
email=email).exclude(username=username).count(): | |
raise forms.ValidationError( | |
"A user with that email already exists") | |
return email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment