在 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 这是一个非常全面的解决方案,包括修补管理员和 createsuperuser
管理命令,其中其他点点滴滴.
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-电子邮件用户名.
Edit: As of Django 1.5 onwards you should consider using a custom user model instead of django-email-as-username.
这篇关于在 Django 中接受电子邮件地址作为用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!