How to make email field unique in model User from contrib.auth in Django

后端 未结 19 2105
夕颜
夕颜 2020-11-27 11:47

I need to patch the standard User model of contrib.auth by ensuring the email field entry is unique:

User._meta.fields[4].unique = True
<         


        
19条回答
  •  情话喂你
    2020-11-27 12:17

    Django has a Full Example on its documentation on how to substitute and use a Custom User Model, so you can add fields and use email as username.

提交回复
热议问题