Default auth with username but unique email, is it possible?

31 views
Skip to first unread message

Bruce Li

unread,
Jan 26, 2015, 11:34:03 AM1/26/15
to django...@googlegroups.com
Hi,

I'm using django's default auth settings in my app. All I want is to make email unique for each user. Is it possible to do that without creating a custom user model and user manager?


Thanks.

Daniel França

unread,
Jan 26, 2015, 12:49:43 PM1/26/15
to django...@googlegroups.com
There's a solution referred here: http://stackoverflow.com/questions/1160030/how-to-make-email-field-unique-in-model-user-from-contrib-auth-in-django

This solution basically override the clean_email method of the UserForm, and check if the email is unique, raising an error if it's not.
But I rather stick with the custom user model, cleaner. Any reason why you wouldn't like to create the custom user model?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1a71b204-c675-494a-a9de-ca496a5015a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages