Reputation: 90999
I have a django model like this:
class Player(models.Model):
name = models.CharField()
batting = models.IntegerField()
bowling = models.IntegerField()
What would be the Django QuerySet equivalent of the following SQL?
SELECT * FROM player WHERE batting > bowling;
Upvotes: 9
Views: 5226
Reputation: 18661
In django 1.1 you can do the following:
players = Player.objects.filter(batting__gt=F('bowling'))
See the other question for details
Upvotes: 20