Python 是否可以对给定的模型继承进行查询查找?

Python 是否可以对给定的模型继承进行查询查找?,python,django,django-models,django-queryset,Python,Django,Django Models,Django Queryset,下面是我的模型,我正在使用django模型utils的InheritanceManager。我决定字段user在子类中,因为我需要通过像user.child1\u set.all()这样的关系访问Child子类 问题是,当我想从Mother类开始进行查询时,似乎没有任何查询可以进行查询 我试过这些密码 Mother.objects.filter(user=SOMEUSER) Mother.objects.filter(child1__user=SOMEUSER) Mother.objects.s

下面是我的模型,我正在使用
django模型utils
InheritanceManager
。我决定字段
user
在子类中,因为我需要通过像
user.child1\u set.all()这样的关系访问
Child
子类

问题是,当我想从
Mother
类开始进行查询时,似乎没有任何查询可以进行查询

我试过这些密码

Mother.objects.filter(user=SOMEUSER)
Mother.objects.filter(child1__user=SOMEUSER)
Mother.objects.select_subclasses().filder(user=SOMEUSER)
Mother.objects.select_subclasses().filder(child1__user=SOMEUSER)

如果您有任何建议,我们将不胜感激。

我认为您无法查询仅适用于儿童的字段。假设一个子类没有
user
字段。Django应该在那里查询什么?尝试将
user
字段移动到父项。如果这没有帮助,我会查看InheritanceManager的源代码。我认为您无法查询仅在子项上可用的字段。假设一个子类没有
user
字段。Django应该在那里查询什么?尝试将
user
字段移动到父项。如果这没有帮助,我会查看InheritanceManager的源代码。
Mother.objects.filter(user=SOMEUSER)
Mother.objects.filter(child1__user=SOMEUSER)
Mother.objects.select_subclasses().filder(user=SOMEUSER)
Mother.objects.select_subclasses().filder(child1__user=SOMEUSER)