forms.py
from django.contrib.auth.models import User
class RegistrationForm(forms.Form):
def clean_email(self):
"""
Validate that the supplied email address is unique for the
site.
"""
if User.objects.filter(email__iexact=self.cleaned_data['email']):
raise forms.ValidationError(_("This email address is already in use.\
Please supply a different email address."))
return self.cleaned_data['email']
Немає коментарів:
Дописати коментар