Answer the question
In order to leave comments, you need to log in
How, when selecting in one select field, filter the values of another in Django admin?
There are several related models, here is an example:
class League(models.Model):
name = models.CharField(max_length=50)
...
class Team(models.Model):
name = models.CharField(max_length=50)
league = models.ForeignKey(League)
...
class Player(models.Model):
league = models.ForeignKey(League, blank=True, null=True)
team = models.ForeignKey(Team, blank=True, null=True)
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question