Won't normalize_email will allow two distinct users u...@example.com and u...@example.com to be created? Case insensitive searches will return multiple users for a 'get'.
Perhaps the closest we can get is to ensure that any user created using Django functions is saved with a consistent case transformation and then perform an *exact* search after applying the same transformation to the input? One idea could be to add a 'transform_email' or similar hook that by default calls normalize_email and ensure that it is applied both to data that is about to be saved and to search terms. Projects that wish to change the behaviour can simply override transform_email to perform for example lowercase conversion if so desired. Atul On 27 February 2014 11:43, Russell Keith-Magee <russ...@keith-magee.com>wrote: > > On Thu, Feb 27, 2014 at 8:31 AM, Curtis Maloney < > cur...@acommoncreative.com> wrote: > >> Doesn't the UserManager already have a "normalize_email" method which >> lower-cases the domain and leaves the mailbox name alone? >> >> IMHO It's "proper" to leave it this way by default, and probably mention >> in the docs it's used so if you want to change it, that's the hook. >> > > 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. > > 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. > > Yours, > Russ Magee %-) > > -- > 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 django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > 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/CAJxq84_1%2B_oVDUAeHyXoFGTirsZEgejaY6q4hNK0EZGpqS96Wg%40mail.gmail.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > -- 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 django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. 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/CAHdnYzuJw_g2ZmzoQ%2B51v5BC1FcD0wN4TgazFoJgT1ZVEYDOWA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.