views:

48

answers:

1
class Content(models.Model):
    .....stuff here

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

This is my database schema. As you can see, each Content has a score. How do I do this:

Select all from Content where Content's Score is 1?

+5  A: 

Content.objects.filter(score__real_score=1)

Till Backhaus