#admin.py
class GameListAdmin(admin.ModelAdmin):
list_display = ['game', 'position']
ordering = ('position',)
class GameAdmin(admin.ModelAdmin):
list_display = ['name', 'status']
actions = [make_published]
#models.py
class Game(models.Model):
name = models.CharField(max_length=200)
status = models.CharField(max_length=1, choices=STATUS_CHOICES)
def __unicode__(self):
return self.name
class GameList(models.Model):
game = models.ForeignKey(Game)
position = models.IntegerField()
def __unicode__(self):
return self.game.name
I'm trying to show game.status in GameListAdmin's list_display but not sure how to do a backwards lookup using the ForeignKey in Admin.py
Any ideas?