Created
November 23, 2016 17:08
-
-
Save mbmohib/f25e8b1f7976f46500a507e475a19951 to your computer and use it in GitHub Desktop.
Checking more than one filed 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(self): | |
try: | |
User.objects.get(first_name=self.cleaned_data['first_name'], | |
last_name=self.cleaned_data['last_name']) | |
raise forms.ValidationError("Exists already!") | |
except User.DoesNotExist: | |
pass | |
return self.cleaned_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment