def clean_email(self):
email = self.cleaned_data.get("email", "")
try:
auth.models.User.objects.get(email__iexact=email)
raise forms.ValidationError(_("A user using that email address already exists."))
except MultipleObjectsReturned:
raise forms.ValidationError(_("A user using that email address already exists."))
except auth.models.User.DoesNotExist: # @UndefinedVariable
pass
return email
评论列表
文章目录