jam*_*jar 1 django django-models django-migrations
我想摆脱运行迁移时收到的以下消息:
The following content types are stale and need to be deleted:
appname | modelname
Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
Run Code Online (Sandbox Code Playgroud)
在迁移中对删除或不删除的决定进行编码似乎更干净。
在迁移过程中检测和删除过时的ContentType的最干净方法是什么?如果自动创建 ContentType,为什么不自动完成?
迁移数据库时,您可以像这样--noinput添加manage.py:
manage.py migrate --noinput
Run Code Online (Sandbox Code Playgroud)
这样,就不会询问用户。
| 归档时间: |
|
| 查看次数: |
932 次 |
| 最近记录: |