简体   繁体   中英

Email as Username in an existing django app

I created an app where I used to require an email and a username for signup.

Now I would like to change this so that any existing users have their username changed to their email. Any new users will not see the username field upon signup, but in the backend they'd be the same.

I was thinking that I could just set the max_length to the length of email? Then in the backend, I could just set the username to the email when the user signs up. What am I missing here?

You probably need to change the authentication backend and then change your models. More information can be found on the django documentation website:

https://docs.djangoproject.com/en/1.10/topics/auth/customizing/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM