Django中syncdb的陈旧内容类型 [英] stale content types while syncdb in Django

查看:185
本文介绍了Django中syncdb的陈旧内容类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试为我的django项目 syncdb 时,我看到以下抱怨:

While I'm trying to syncdb for my django project, I'm seeing following complains:

The following content types are stale and need to be deleted:

myapp | 

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?
If you're unsure, answer 'no'.

虽然我也读过类似的问题 django-syncdb-many-to-many-stale ,但是我不能冒险自己打字,因为我在prod实例上。

While I've also read the similar problem django-syncdb-many-to-many-stale, but I cannot risk myself typing yes since I'm on prod instance.

安全地删除contenttype中的那些陈旧的条目

Would yes safely delete those stale entries in contenttype?

推荐答案

通常你可以安全地删除它们,这些是不再存在模型的内容类型。
唯一需要注意的是,如果您有其他模型通过 ForeignKey ContentType 模型c $ c>这些对象也将被删除。如果您没有将任何外键设置为 ContentType ,则不会发生任何不良情况,如果您确实评估是否仍需要具有外部内容的对象输入您即将删除(如果有的话)。

Normally you can delete them safely, as these are content types where no model exists anymore. The only thing you should be aware of is, that if you had other models pointing to the ContentType model via a ForeignKey these objects will be deleted as well. If you didn't set any foreign keys to ContentType at all nothing bad can happen, if you did evaluate if you would still need the objects that have a foreign key to the content type you are about to delete (if there are any).

这篇关于Django中syncdb的陈旧内容类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆