我正在查看 GenericForeignKeys
上的 Django 文档 1.6 。我对这个新声明的含义感到困惑。有人可以解释一下吗?
for_concrete_model
New in Django 1.6.
If
False
, the field will be able to reference proxy models. Default isTrue
. This mirrors thefor_concrete_model
argument toget_for_model()
.
最佳答案
Proxy models是模型继承的一种形式。
以前,通用外键可以引用“具体”模型(即原始模型),但不能引用代理模型。
Ticket 17648 中引入的新 concrete_for_model
参数如果您使用concrete_for_model=False
,则允许您引用代理模型。
关于python - Django 1.6 for_concrete_model 解释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19821420/