문제

I am trying out django-registration. I found that it allows multiple registration for same emailid. I want to prevent that. What is the best way to do that?

ok, I see there is a subclass RegistrationFormUniqueEmail. Now, how to use this class? I changed this

    def get_form_class(self, request):

    return RegistrationFormUniqueEmail

But, it must be better to change this from my application rather than in source code. So, how do I do that? thanks

도움이 되었습니까?

해결책

Once you've added registration to your settings file, you can use the form in your views.py like so:

from registration.forms import RegistrationFormUniqueEmail

form = RegistrationFormUniqueEmail()

That's it. That will give you the form that you need and will take care of the unique email validation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top