Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique Email - allow blank #9

Open
sibe7691 opened this issue Apr 24, 2015 · 5 comments
Open

Unique Email - allow blank #9

sibe7691 opened this issue Apr 24, 2015 · 5 comments

Comments

@sibe7691
Copy link

Hi, with the option REQUIRE_UNIQUE_EMAIL set to True,
Is there a way to allow emails to still be blank?

@madssj
Copy link
Owner

madssj commented Apr 24, 2015

Make your emails null, not blank. An empty string is still a value in the DB, so the unique constraint will disallow you from having multiple values of the same.

Closing this issue.

@madssj madssj closed this as completed Apr 24, 2015
@sibe7691
Copy link
Author

Ok, but this causes problem in django admin page, since email appears to be required now, i cannot save without it complaining.

@madssj
Copy link
Owner

madssj commented Apr 24, 2015

Ah, that's true. I'll look at that at some point, if you need it now, feel free to send in a PR.

@madssj madssj reopened this Apr 24, 2015
@elnygren
Copy link

I believe this could could be fixed by allowing changing this field by a setting similar to email's length and uniqueness.
https://github.com/madssj/django-longer-username-and-email/blob/master/longerusernameandemail/models.py#L33

@madssj
Copy link
Owner

madssj commented Apr 27, 2015

One way to fix it would be to set the models .blank to be the same as the result of the call to REQUIRE_UNIQUE_EMAIL().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants