Let's assume we have the following two models:
class Player(Model):
alliance = ForeignKey("Alliance")
points = PositiveIntegerField()
class Alliance(Model):
points = PositiveIntegerField()
Every player and every alliance have a specific amount of points. Total alliance points are count alliance.points + Sum(player_set__points)
.
What I want to do is to fetch all the alliances ordered by the amount of total points. The problem is that I do not seem to be able to do Sum + Sum in aggregation.