ups i think return Teams.objects.get(self.team1_id).name
will be better :) Sebastian Bauer pisze: > try this: > > return Teams.objects.get(self.team1).name > > > nikosk pisze: > >> Hi all >> >> Does anyone know how to do something like this : >> >> class Game(models.Model): >> team1 = models.ForeignKey(Teams, related_name=u'team_home') >> team2 = models.ForeignKey(Teams , related_name=u'team_away') >> round = models.ForeignKey(Round) >> game_date = models.DateField() >> def __unicode__(self): >> return Teams.objects.filter(self.team1) <<<<<<<< DOES NOT >> WORK >> >> Basically I want __unicode__ to return Teams.name based on the foreign >> key reference >> >> thanks in advance >> >> >> >> >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---