django admin中的list_display设置了,但是页面没有显示出来列
原code
from django.contrib import admin
from .models import Grades,Students
class GradesAdmin(admin.ModelAdmin):
# 列表属性
list_display = [‘pk’,‘gname’,‘gdate’,‘ggirlnum’,‘gboynum’,‘isDelete’]
list_filter = [‘gname’]
search_fields = [‘gname’]
list_per_page = 5
# 添加、修改页属性
#fields = ['ggirlnum','gboy','gname','gdate','isDelete']
fieldsets = [
("num",{"fields":['ggirlnum','gboynum']}),
("base",{"fields":['gname','gdate','isDelete']}),
]
admin.site.register(Grades)
admin.site.register(Students)
from django.contrib import admin
from .models import Grades,Students
class GradesAdmin(admin.ModelAdmin):
# 列表属性
list_display = [‘pk’,‘gname’,‘gdate’,‘ggirlnum’,‘gboynum’,‘isDelete’]
list_filter = [‘gname’]
search_fields = [‘gname’]
list_per_page = 5
# 添加、修改页属性
#fields = ['ggirlnum','gboy','gname','gdate','isDelete']
fieldsets = [
("num",{"fields":['ggirlnum','gboynum']}),
("base",{"fields":['gname','gdate','isDelete']}),
]
admin.site.register(Grades,GradesAdmin)
admin.site.register(Students)
把新的类GradesAdmin添加到admin.site.register()中