django继承修改 User表导致的问题 fields.E304(permissions/group都会有这样的错误)

来源:互联网 发布:比尔盖茨书单 知乎 编辑:程序博客网 时间:2024/04/19 21:03

问题:

django继承修改 User表时,进行migrations操作时会导致的问题 fields.E304(permissions/group都会有这样的错误)如图:

根源:

django文档中有注明:

Due to limitations of Django’s dynamic dependency feature for swappablemodels, the model referenced byAUTH_USER_MODEL must be created inthe first migration of its app (usually called0001_initial); otherwise,you’ll have dependency issues.

因此如果涉及到修改用户表,一定要保证用户表的migration编号是0001_,否则会有依赖性问题。因为其他的权限表什么的已经简历了,


解决办法:

1.清空数据库,清除文件中的migrations文件夹(我是全删除了,)

2.先给User所在的表做migrations操作,然后再做其他的migrations做到

3.migrate

4.解决问题请点赞哈哈


阅读全文
1 0
原创粉丝点击