【发布时间】:2011-01-17 14:52:05
【问题描述】:
我有这些模型:
def Foo(Models.model):
size = models.IntegerField()
# other fields
def is_active(self):
if check_condition:
return True
else:
return False
def Bar(Models.model):
foo = models.ForeignKey("Foo")
# other fields
现在我想查询具有活动 Foo 的 Bars:
Bar.objects.filter(foo.is_active())
我收到诸如
之类的错误SyntaxError at /
('non-keyword arg after keyword arg'
我怎样才能做到这一点?
【问题讨论】: