Django 管理员根据另一个选择框精炼选择框值
我有以下模型:
国家/地区
省/州
城市
地区
社区
Django 管理中有没有一种方法可以根据前一个选择框中的选择来过滤选择框中的值? 例如:我在国家/地区选择框中选择加拿大,然后在省/州选择框中仅显示省份。选择后,城市选择框仅显示所选省份内的城市。等等...
我一直在查看 formfield_for_foreignkey,但我还无法让它工作。我可能没有正确理解其用途。
谢谢
I have models for the following:
Country
Prov/State
City
Region
Community
Is there a way in the Django admin to filter the values in the select boxes based on the selection in the previous select box?
eg: I select Canada in the country select box, then in the Prov/State select box I am only presented with the Provinces. Once that is selected, the City select box only presents cities within the Province selected. etc...
I have been looking at the formfield_for_foreignkey, but I haven't been able to get it working just yet. I may not be understanding the use correctly.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如我所怀疑的,看来我必须深入研究一些基于 Ajax 框架的东西才能做我想做的事情。对于那些感兴趣的人,以下是我发现有些有用的一些网站的链接。
DajaxProject
Dojo
如果有人有任何其他建议,请告诉我。
As I suspected, it appears that I will have to dig into something based on the Ajax framework to do what I want to do. For those interested, the following are links to some sites that I found to be somewhat useful.
DajaxProject
Dojo
If anyone has any other suggestions, please let me know.