django继承User表导致的问题
扩展默认的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