I have two dropdownlists in a Django admin site. For example, I have SelectCountry and SelectRegion. Region has a foreignkey relationship to Country. How do I ensure that when a Country is selected, the Regions are filtered based on that Country?
N.B: I am using django-grappelli for my admin backend as well.
Any ideas will be appreciated. Thanks.
As DrMeers hints at, use django-smart-selects. No point in re-inventing the wheel.
来源:https://stackoverflow.com/questions/9853595/how-to-filter-a-dropdownlist-in-djangos-admin-when-a-selection-is-made-on-anoth