django_simpleui的应用

simpleui,后台主题框架主要是为了美化和简化django内置的后台管理界面(elemet-ui+vue)

两个地方需要准备一下:

需要安装simpleui模块

需要在settings.py-app-引用一下(添加'simpleui')

from django.contrib import admin

from . import models

class Articleadmin(admin.ModelAdmin):
    list_display = ['desc','category']#显示哪些字段
    search_fields = ['title']#搜索,有外键关联的不能写 比如category
    list_filter = ['is_delete','title']#关键字过滤
    list_per_page = 20

class Categoryadmin(admin.ModelAdmin):
    list_display = ['name']#显示哪些字段
    search_fields = ['name']#搜索,有外键关联的不能写 比如category
    list_filter = ['is_delete']#关键字过滤
    list_per_page = 10

#自定义后台的名字
class Myadminsite(admin.AdminSite):
    site_header = '博客管理系统'
    site_title = '博客管理系统'
site = Myadminsite()

# Register your models here.
# admin.site.register(models.Category,Categoryadmin)
# admin.site.register(models.Article,Articleadmin)

#自定义后台的名字
site.register(models.Article,Articleadmin)
site.register(models.Category,Categoryadmin)
posted @ 2020-01-03 14:27  小马哥007  阅读(2407)  评论(0编辑  收藏  举报