admin页面显示表的样式调整

from django.contrib import admin
from app import models
# Register your models here.

class BookAdmin(admin.ModelAdmin):#显示id,name,price
    list_display = ("id","name","price")
    list_editable = ("name","price")#name就是可编辑直接修改,效果看页面
    #filter_horizontal = ("author",)#水平的#The value of 'filter_horizontal' must be a list or tuple.必须加逗号
    list_per_page = 1 #每页几条记录,划重点
    list_filter = ("author",)#过滤,当页面搜索tom,时,作者里为tom的选项不会显示,只显示name为tom


admin.site.register(models.Book,BookAdmin)
admin.site.register(models.Author)

 

posted @ 2018-08-06 16:55  未来的技术  阅读(150)  评论(0编辑  收藏  举报