Django: list_filter and foreign key fields

前端 未结 6 1827
野性不改
野性不改 2021-02-07 00:54

Django doesn\'t support getting foreign key values from list_display or list_filter (e.g foo__bar). I know you can create a module method as a workaround for list_display, but h

6条回答
  •  鱼传尺愫
    2021-02-07 01:38

    You can easily create custom filters since Django 1.4 by overriding django.contrib.admin.SimpleListFilter class.

    More information :

    1. Admin list_filter documentation ;
    2. Django-1.4 release note.

提交回复
热议问题