Show a ManyToManyField as Checkboxes in Django Admin

后端 未结 4 1229
滥情空心
滥情空心 2021-02-02 09:32

Is there a simple way to show a ManyToManyField as Checkboxes in Django Admin? Thanks in advance!

4条回答
  •  悲&欢浪女
    2021-02-02 10:16

    I think there is no simple way to do this. You can try to override ModelAdmin class but this is not a "simple" way.

    But you can use filter_horizontal or filter_vertical to add almost similar functionality

    http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter_horizontal

提交回复
热议问题