blob: f69397f4f39f7772eb2806d8fd87e897343dc722 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
|