【发布时间】:2016-01-15 20:18:50
【问题描述】:
我正在尝试创建一个自定义管理器,它返回所有没有附加 Bar 的 Foo 实例。
# models.py
class Foo(models.Model):
...
class Bar(models.Model):
foo = models.OneToOneField(Foo)
...
# managers.py
class FooQueryset(BaseQueryset):
def no_bar(self):
return ???
class FooManager(BaseManager):
def get_queryset(self):
return EcheanceQueryset(self.model, using=self._db)
def no_bar(self):
return self.get_queryset().no_bar()
我正在就查询集寻求帮助以获得所需的结果
【问题讨论】:
标签: django python-3.x django-queryset django-1.7