1、 自定义菜单
adminx.py
class GlobalSetting(object): site_title = u'xxx后台' def kuF_site_menu(self): return [{ 'title': u'用户&账户', 'perm': self.get_model_perm(User, 'view'), 'icon':'fa fa-users', 'menus':( {'title': u'用户', 'url': self.get_model_url(User, 'changelist')}, {'title': u'账户', 'url': self.get_model_url(Account, 'changelist'), 'perm': self.get_model_perm(Account, 'view'), }, {'title': u'用户套餐', 'url': self.get_model_url(AccountLogs, 'changelist'), 'perm': self.get_model_perm(AccountLogs, 'view'), }, ) }, ] def get_site_menu(self): menus = [] from xxx_app.adminx import card_pool_site_menu menus.extend(card_pool_site_menu(self)) menus.extend(self.kuF_site_menu()) return menus xadmin.site.register(CommAdminView, GlobalSetting)
2、 折叠
增加xsite文件及配置
xsite.py
# -*- coding:utf-8 -*- from xadmin import Settings class Base(Settings): enable_themes = True #use_bootswatch = True class Comm(Settings): menu_style = 'accordion'
settings.py
XADMIN_CONF = 'web.xsite'
以上这篇对django xadmin自定义菜单的实例详解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。