0

I'm using django 1.7. I have installed django-registration-redux and created the templates required to render the registration form. How can I ensure that the email address is unique in the registration form. I can perhaps create custom user registration model and then give a unique constraint to the email? Are there alternatives?

I was looking at the solution earlier but this is for the "django-registration"

Django-registration, force unique e-mail

The monkey patch in the model below seems to work but then it's just throwing a nasty error message, instead I want it throw the error message above the email field

User._meta.get_field('email')._unique = True
Community
  • 1
  • 1
cloudviz
  • 971
  • 4
  • 15
  • 40

1 Answers1

3

I didn't use this module but I have just googled and found out:

registration.forms.RegistrationFormUniqueEmail

A subclass of RegistrationForm which enforces uniqueness of email addresses in addition to uniqueness of usernames.

Source.

Update: I have read that thread carefully and even found that upvoted one of the answers there. django-registration-redux is just updated django-registration for Django 1.6/1.7. So this form RegistrationFormUniqueEmail is exactly what you should use.

Community
  • 1
  • 1
bellum
  • 3,642
  • 1
  • 17
  • 22
  • Thanks it pointed me in the right direction. http://stackoverflow.com/questions/16379300/how-to-use-different-view-for-django-registration – cloudviz Apr 17 '15 at 22:02