django-模型-utils。我正在尝试InhertianceManager的基本用法,如文档中所述。
nearby_places = Place.objects.filter(location='here').select_subclasses()唯一的区别是我的父模型/类是抽象的。这还能用吗?
我会犯这样的错误
在呈现时捕获DatabaseError:(1146,“表'proj.ParentModel‘不存在”)
和
‘'Options’对象没有属性'_join_cache‘
这两个错误都是在尝试对抽象类执行查询时通常会出现的错误。
在我的父模型中,我将经理定义如下:
class ParentModel(OrderedModel):
objects = InheritanceManager()发布于 2012-04-04 07:39:27
按照从docs到杰夫·埃尔莫的博客的链接(也就是InheritanceManager的作者),他描述了InheritanceManager是如何工作的。
很明显,父模型/类不能抽象。
……实际上,我应该在第一次从代码中看出这一点.
https://stackoverflow.com/questions/10006494
复制相似问题