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

后端 未结 19 2038
夕颜
夕颜 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:11

    from an User inherited model, redefine the attribute correctly. It should work, as is it's not usefull to have that in django core because it's simple to do.

提交回复
热议问题