I'm setting up a database for data related to sporting event stats. My database has a Game model, which is linked to a TeamGame model (stats related specifically to each team that played in that game). These two models are linked as ManyToMany, as we're going to have multiple games and each game is going to have multiple Teams. I would like both of these models to be ordered by the game's date, which is a column in the Game table but I'm having trouble figuring out how to set a Meta class to do this in the TeamGame model. Here's the relevant code for each - can someone please help me with the syntax that I'd need to use in the TeamGame model to sort by date (and also so that home/away classification doesn't interfere with the date sorting)?
class Game(models.Model): game_id = models.IntegerField(primary_key = True) date = models.DateField() team_home = models.ForeignKey(TeamGame, related_name='home') team_away = models.ForeignKey(TeamGame, related_name='away') class Meta: ordering = ['date'] class TeamGame(models.Model): team = models.ForeignKey(Team) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.