我目前正在尝试在我的django应用程序中实现下拉列表过滤器,但不知何故无法使其工作。首先尝试使用diy方法,但决定尝试使用django-admin-list-filter-dropdown app,但仍然没有成功
settings.py
INSTALLED_APPS = [
...
'django_admin_listfilter_dropdown',
...
]
admin.py
from django_admin_listfilter_dropdown.filters import DropdownFilter, RelatedDropdownFilter
@admin.register(models.Project)
class ProjectAdmin(admin.ModelAdmin):
list_display = (
"name",
"entry_date",
)
list_filter = (
("name", DropdownFilter),
"entry_date",
)
有什么建议吗?提前致谢