django-registration унікальний e-mail

хороший аплікейшен, але в ньому є один баг або фіча - дозволяє реєстрацію користувачів з однаковими e-mail'ами. Лікується додаванням метода clean_email:

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']

Немає коментарів: