2010-01-14 65 views
1
class Content(models.Model): 
    .....stuff here 

class Score(models.Model): 
    content = models.OneToOneField(Content, primary_key=True) 
    real_score = models.IntegerField(default=0) 

这是我的数据库模式。正如你所看到的,每个内容都有一个分数。 我该如何做到这一点:django选择查询 - 我该如何做到这一点?

全选自内容的分数是1的内容?

回答

5

Content.objects.filter(score__real_score=1)