title: Sort Django models based on the maximum value of multiple fields
body: <p>I have a model that stores data for teams. Each team has three fields for each match played (match1, match2, etc.) that store a point value. I need to be able to sort these teams based on the highest score in any of the three matches, but Django's order_by method only sorts based on the max of one value. Is there a way for me to provide multiple parameters and have it choose the greatest value when sorting? Here is what my code looks like so far:</p>
  
  <pre><code>#models.py
  class Team(models.Model):
      match1 = models.CharField(max_length=4, blank=True, default="/")
      match2 = models.CharField(max_length=4, blank=True, default="/")
      match3 = models.CharField(max_length=4, blank=True, default="/")
  </code></pre>
  
  <pre><code>#views.py
  def team_rankings(request): # Scoreboard/rankings of teams
      context = {
          'teams': Team.Objects.all().order_by(#All three match results here)
      }
      return render(request, 'scoring_system/rankings.html', context)
  </code></pre>