在Django中接受电子邮件地址作为用户名 [英] Accepting email address as username in Django
问题描述
在django中是否有一个很好的方式,而不用滚动自己的身份验证系统?我想要用户名作为用户的电子邮件地址,而不是创建用户名。
Is there a good way to do this in django without rolling my own authentication system? I want the username to be the user's email address instead of them creating a username.
请指教,谢谢。
推荐答案
对于任何想要这样做的人,建议您查看 django-email-as-username ,这是一个非常全面的解决方案,包括修补管理员和 creationuperuser
管理命令
For anyone else wanting to do this, I'd recommend taking a look at django-email-as-username which is a pretty comprehensive solution, that includes patching up the admin and the createsuperuser
management commands, amongst other bits and pieces.
修改:从Django 1.5起,您应该考虑使用自定义用户模型,而不是 django-email-as-username 。
Edit: As of Django 1.5 onwards you should consider using a custom user model instead of django-email-as-username.
这篇关于在Django中接受电子邮件地址作为用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!