开发者

Django - models.CharField- choices - Option Buttons instead of Select box

For models.CharField(), we use to give a choices attribute. Normally these choices will be displayed in select box. Is it possible to display the option buttons ins开发者_如何学JAVAtead of select box (in admin interface)? Any suggestions?

status = models.CharField(max_length = 25, choices = (('IN PROGRESS', 'IN PROGRESS'),('COMPLETED','COMPLETED')))


The following ModelAdmin subclass (in your admin.py) does what you're after:

class PersonAdmin(admin.ModelAdmin):
    radio_fields = {"group": admin.VERTICAL}

HORIZONTAL is also possible.

From the Django docs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜