I just got my first django app up: http://brackets.bracketboy.net/ Not
very impressive, but I'm still excited about it. anyway . . .


I'm having trouble accesing a method through the admin interface as
part of a choices list. It seems to work fine throughout the site and
the admin interface, but not in choices selection. In the choices I
get <properties object at XXXXX>.  Any ideas?

Some of the relevant code:

  def _get_team_2(self):
      if self.round == 1 :
        return
Team.objects.filter(seed=self.seed_2).filter(region=self.region)
[0].name

      else:
        prev_game =   Game.objects.get( id = self.id ).prev_game_2_id
        prev_winner = Game.objects.get( id = prev_game ).winner.id
        return        Team.objects.get( id = prev_winner ).name

  team_2 = property( _get_team_2)

  winner = models.IntegerField(choices=((team_1.id, team_1),
(team_2.id, team_2),),)


(Since the winner field is just storing id's, I had initlaly hoped to
do it with a foreign key and limit_choices_to, but I wasn't able to
even get that close. But that's a question for another day, unless
somebody has the answer)


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to