当在另一个下拉列表中进行选择时,如何过滤Django管理员中的下拉列表 [英] How to filter a dropdownlist in Django's admin when a selection is made on another dropdownlist
本文介绍了当在另一个下拉列表中进行选择时,如何过滤Django管理员中的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
注意:我还在管理后端使用django-grappelli。
任何想法将不胜感激。谢谢。
解决方案
正如DrMeers提示,使用 django-smart-choices 。没有重点发明轮子。
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.
这篇关于当在另一个下拉列表中进行选择时,如何过滤Django管理员中的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文