Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django-registration, force unique e-mail

Tags:

python

django

Can I force users to make unique e-mail addresses in django-registration?

like image 367
DJPython Avatar asked Jan 25 '10 10:01

DJPython


2 Answers

For later versions of django_registration (that use class-based views), you can do this:

from registration.forms import RegistrationFormUniqueEmail
from registration.backends.default.views import RegistrationView

urlpatterns = patterns('',
    url(r'^register/$',
        RegistrationView.as_view(form_class=RegistrationFormUniqueEmail),
        name='registration_register'),
)
like image 114
seddonym Avatar answered Sep 27 '22 17:09

seddonym


from rych's answer, I tested that the following runs ok - it only uses urls.py, you needn't write another cusotmer form.

from registration.forms import RegistrationFormUniqueEmail

url(r'^accounts/register/$', 'registration.views.register',
    {'form_class': RegistrationFormUniqueEmail,
     'backend': 'registration.backends.default.DefaultBackend'},       
     name='registration_register'),
like image 43
raidsan Avatar answered Sep 27 '22 17:09

raidsan