diff options
Diffstat (limited to 'alphabetlearning/payments/forms.py')
-rw-r--r-- | alphabetlearning/payments/forms.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/alphabetlearning/payments/forms.py b/alphabetlearning/payments/forms.py new file mode 100644 index 0000000..f69397f --- /dev/null +++ b/alphabetlearning/payments/forms.py @@ -0,0 +1,14 @@ +from django import forms +from .models import EmailVerification + + +class EmailVerificationForm(forms.ModelForm): + class Meta: + model = EmailVerification + fields = ['email'] + + def clean_email(self): + email = self.cleaned_data.get('email') + if EmailVerification.objects.filter(email=email).exists(): + raise forms.ValidationError("This email address is already in use.") + return email
\ No newline at end of file |