On Thu, 2014-02-27 at 08:43 +0800, Russell Keith-Magee wrote:

> It does - assuming you use User.objects.create_user() to create all
> your users. However, the UserCreationForm doesn't use this (and hasn't
> ever used this); it also doesn't account for fixtures, or any other
> path into the database that might exist. 

Would it be possible to additionally guard in the save() method of the
email User class against duplication by checking with "not
filter(email__iexact=...).exists()"?

The documentation could also explain how to manually add a constraint at
the database level where this is supported. (The current kickstarter
project for improved PostgreSQL support seems likely to add expression
indexes to Django proper one day.)

> So - while normalising case is probably a good idea, and should
> probably be added to the Create/Update User form, the searches will
> still need to be case insensitive.

While there is no way to enforce this, it could at least be added to the
documentation that get_by_natural_key() should be used for email based
users, or filter(email__iexact=...).

Kind regards, Til

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1393581918.9673.31.camel%40mother.subnetz.org.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to