1

I don't know how to best explain my actual issue so here's something completely analogous. Auction listings and their bids.

class Auction(models.Model):
    name = models.CharField(...)

class Bid(models.Model):
    auction = models.ForeignKey(Auction, related_name="bids")
    amount = models.PositiveIntegerField(default=0)

I want a list of auctions, ordered by the highest bid. I have a feeling this is going to have something to do with an aggregative Max, but can I go on to order by that aggregate value?

I have a feeling this is going to be really simple but I haven't really ever got into the aggregate stuff yet.

4

1 に答える 1