Username as email

17 views
Skip to first unread message

Soumen Khatua

unread,
Nov 24, 2019, 12:56:01 AM11/24/19
to django...@googlegroups.com
Hi Folks,
Any have any idea in real time how programmers manage email id as username only. Because django provide different fields for username and email id. So how I can overcome to this problem??

Thank you in advance. 

Regards, 
Soumen

Maher, Brian

unread,
Nov 24, 2019, 12:58:58 AM11/24/19
to django...@googlegroups.com
I maintain one project which does this with a save hook on the User model, setting the username to the email address field (with uniqueness tests, of course).

It’s crude, but seems to work well and hasn’t given any problems.

Best Regards,
Brian Maher

Senior Research Software Engineer & Systems Administrator
King’s Digital Lab
VWB, 2nd Floor, Room 2.50, Strand Campus

Work: 0207 848 0511
Mobile: 07714 285086
Voip: 01702 667471

From: django...@googlegroups.com <django...@googlegroups.com> on behalf of Soumen Khatua <soumenk...@gmail.com>
Sent: Sunday, November 24, 2019 6:55:22 PM
To: django...@googlegroups.com <django...@googlegroups.com>
Subject: Username as email
 
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6WaQro%3DxhcjdB7am-LdtF%2BSQ02cgePiXs2x4WeJrJNtRwg%40mail.gmail.com.

אורי

unread,
Nov 24, 2019, 1:29:37 AM11/24/19
to django...@googlegroups.com
Hi,

In Speedy Net users can login either with username or with email. And notice, users may have more than one email address. You can look at the code on GitHub. You can set function get_by_natural_key in the user manager to find the user by email address. For example:


Please notice also that this form converts the email to lowercase, so that also uppercase email is accepted in the login form. The email is always saved as lowercase in the database (when the user registered or adds a new email address).

--

Soumen Khatua

unread,
Nov 24, 2019, 2:42:27 AM11/24/19
to django...@googlegroups.com
Thank you for response, I'll look into it.


Reply all
Reply to author
Forward
0 new messages