blob: 3aa2d95dafe2396e9a415bb451c52f48fb645e82 (
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
|