我试图在模型管理搜索_字段中包含一个内联字段,但我无法计算它。在
from django.contrib import admin
from yourapp.models import Supplier, Product
class ProductInline(admin.TabularInline):
model = Product
class SupplierAdmin(admin.ModelAdmin):
inlines = [ProductInline,]
admin.site.register(Supplier, SupplierAdmin)
这里我想在SupplierAdmin类中搜索产品,虽然产品是内联的,但我无法获得搜索功能
您需要创建自定义过滤器对象并将其传递给Admin类的list\u filters属性。有关详细信息,请参阅documentation
基本上你需要的是有一个过滤器,比如:
相关问题 更多 >
编程相关推荐