0

So I have a model like this:

class Season(models.Model):
    number = models.IntegerField()
    show = models.ForeignKey("Show")

class Show(models.Model):
    name = models.CharField(max_length=255, null=True, blank=True)

Inside my SeasonAdmin I can see that the show field has a dropdown box for the list of Shows, but the problem is that when I click on the dropdown box I just see a list of Show object. How would I make it show the object name instead of just Show object?

Kil
  • 29
  • 3

1 Answers1

1

You need to define the __str__ method:

class Show(models.Model):
    name = models.CharField(max_length=255, null=True, blank=True)

    def __str__(self):
        return "%s" % self.name
NS0
  • 6,016
  • 1
  • 15
  • 14