Can I change the USERNAME_FIELD in Django 1.5 without creating a custom user?

前端 未结 2 904
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 20:08

I am trying to use the email field in the default Django user model as the username. I am using Django 1.5 and I saw that the default user has a USERNAME_FIELD

2条回答
  •  悲哀的现实
    2021-01-04 20:34

    #Your app's __init__.py
    
    from django.contrib.auth.models import User
    
    User.USERNAME_FIELD = 'email'
    

提交回复
热议问题