django error:auth.User.groups: (fields.E304) Reverse accessor for ‘User.groups’ clashes with reverse accessor for ‘UserProfiles.groups’.

上面的报错出现在我将原定的models, views及ulrs迁移到的app中后,在将所有我认为需要修改的都修改

了之后运行命令:makemigrations命令时出现的

如上图

解决办法:

在settings.py中加入下面的内容:

AUTH_USER_MODEL = 'users.UserProfiles'

 注: users是我的app名, UserProfiles是我的models名字

即格式为:

AUTH_USER_MODEL = 'myapp.mymodel'

 这里好像只能是user,因为其它model不会与内置的auth表冲突!

原文地址:https://www.cnblogs.com/Andy963/p/7718138.html