TIMEX
TIMEX

Reputation: 271614

django select query--how do I make this?

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?

Upvotes: 1

Views: 237

Answers (1)

tback
tback

Reputation: 11561

Content.objects.filter(score__real_score=1)

Upvotes: 5

Related Questions