Django model help
Posted
by dotty
on Stack Overflow
See other posts from Stack Overflow
or by dotty
Published on 2010-05-27T14:57:01Z
Indexed on
2010/05/27
15:01 UTC
Read the original article
Hit count: 227
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")
© Stack Overflow or respective owner