Django - ChoiceField - 选项按钮而不是选择框 [英] Django - ChoiceField - Option Buttons instead of Select box
本文介绍了Django - ChoiceField - 选项按钮而不是选择框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在 ChoiceField
中显示选项按钮而不是选择框(在管理界面中)?任何建议?
Is it possible to display the option buttons instead of select box (in the admin interface) for ChoiceField
? Any suggestions?
推荐答案
以下 ModelAdmin
子类(在您的管理员中) py)做你以后的事情:
The following ModelAdmin
subclass (in your admin.py) does what you're after:
class PersonAdmin(admin.ModelAdmin):
radio_fields = {"group": admin.VERTICAL}
HORIZONTAL
也可以。
从 Django docs 。
这篇关于Django - ChoiceField - 选项按钮而不是选择框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文