首页 > 其他 > 详细

django继承修改 User表导致的问题

时间:2018-11-24 17:03:38      阅读:211      评论:0      收藏:0      [点我收藏+]

扩展默认的auth_user表参考:

http://www.cnblogs.com/liwenzhou/p/9030211.html#undefined

django继承修改 User表时,python  manage.py  makemigrations进行python  manage.py  migrate操作时会导致的问题如图:

技术分享图片

根源:
django文档中有注明:

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

因此如果涉及到修改用户表,一定要保证用户表的migration编号是0001_,否则会有依赖性问题。

 

解决办法:
1.清空(删除)数据库,清除文件中的migrations文件夹(除了__init__.py文件)

2.现在执行 python  manage.py  makemigrations 和 python  manage.py  migrate 操作即可成功。


参考博文:

http://www.cnblogs.com/liwenzhou/p/9030211.html#undefined

https://blog.csdn.net/u010377372/article/details/78426372?utm_source=blogxgwz5

 

django继承修改 User表导致的问题

原文:https://www.cnblogs.com/lixiufeng1994/p/10012657.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!