Does anyone have any clue why this doesn't work as expected.
If i use the python shell and do
team.game_set
or
team.games
It returns an error
AttributeError: 'Team' object has no attribute 'game'
If i create a Game object and call
game.home_team
it returns the correct team object
Heres my model
class Team(models.Model):
name = models.CharField(blank=True, max_length=100)
class Game(models.Model):
home_team = models.ForeignKey(Team, related_name="home_team")
UPDATE
I've updated the mode by removing the related_name and i now get this error
app.game: Accessor for field 'home_team' clashes with related field 'Team.game_set'. Add a related_name argument to the definition for 'home_team'.