0

I have the following Models :

class Country(models.Model):
    title = models.CharField(max_length=40)

class City(models.Model):
    title = models.CharField(max_length=40)
    country = models.ForeignKey(Country, on_delete=models.CASCADE)


class Case(models.Model):
    title = models.CharField(max_length=40)
    country = models.ForeignKey(Country, on_delete=models.CASCADE)
    city = models.ForeignKey(City, on_delete=models.CASCADE)

In the Django admin of the Case page, I want to implement the chained dropdown select between country and city. If the user choose USA from the country list, the city list will show only cities of USA.
From other questions here, I see that i have to use 'list_select_related'. but that doesn't work with me. Is there any simple way to implement that ?

Med
  • 69
  • 7
  • Does this answer your question? https://stackoverflow.com/questions/15211799/why-does-django-admin-list-select-related-not-work-in-this-case/28710808 – martin Apr 15 '20 at 15:15
  • I think it's not the same situation. I have two related models shown as dropdown lists in another model. – Med Apr 15 '20 at 17:46

0 Answers0