- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我搜索了 the documentation但我还没有找到任何参数的解释。
DO_NOTHING
的实现正是这样做的,所以我传入的内容应该无关紧要,但对于其他方法(例如 CASCADE),它们实际上被使用了。
我找到的最接近的解释是 a discussion级联。
collector
、field
、sub_objs
和using
是什么数据类型,我要传递什么值?
编辑:
我在我的模型中使用它,像这样:
class Office(models.Model):
# Office locations have a name, and a location.
display_name = models.CharField(max_length=255)
location = models.OneToOneField(
GeoLocation,
on_delete=models.DO_NOTHING(None, None, None, None)
)
最佳答案
你不应该调用 models.DO_NOTHING
,你应该只是将它作为一个值传递:
location = models.OneToOneField(
GeoLocation,
on_delete=models.DO_NOTHING
)
事实上,它是一个函数是一个实现细节,而不是 API 的一部分,这就是为什么这些参数没有记录的原因。
关于python - Django 的 models.DO_NOTHING 需要哪些参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35803443/
有没有办法将FK选项(db_constraint、on_delete等)应用到使用多表继承时自动创建的“_ptr”列?我想阻止 Django 模拟删除级联行为并让数据库本地执行该操作。 最佳答案 我找
我正在查看来自 http://www.boost.org/doc/libs/1_47_0/boost/pool/detail/singleton.hpp 的文档 我的问题:因为 create_obje
我搜索了 the documentation但我还没有找到任何参数的解释。 DO_NOTHING 的实现正是这样做的,所以我传入的内容应该无关紧要,但对于其他方法(例如 CASCADE),它们实际上被
我有一个模型: class Project(Model): name = models.TextField(...) ... bunch of fields ... 我还有一些模型可以
已经搜索过此类主题并找到了 2 个不同的解决方案,但没有一个有效。 我的表有结构 | ID (auto_increment primary_key) | UID(整数) | FAV_ID (整数) |
我是一名优秀的程序员,十分优秀!