from django.contrib import admin from app01.models import * # Register your models here. # @admin.register(Book)#----->单给某个表加一个定制 class MyAdmin(admin.ModelAdmin): list_display = ("title","price","publisher") search_fields = ("title","publisher") list_filter = ("publisher",) ordering = ("price",) fieldsets =[ (None, {‘fields‘: [‘title‘]}), (‘price information‘, {‘fields‘: [‘price‘,"publisher"], ‘classes‘: [‘collapse‘]}), ] admin.site.register(Book,MyAdmin) admin.site.register(Publish) admin.site.register(Author)
原文地址:https://www.cnblogs.com/hackerer/p/12417124.html
时间: 2024-10-09 06:54:50