xadmin的后台模板设置后还是不显示?
来源:5-5 xadmin全局配置
EDDYCJY
2017-08-19
按照老师课程设置参数后,仍旧是只有默认和bootstrap2(文件位置也确定是app/users/adminx.py无误)
# -*- coding:utf-8 -*- import xadmin from xadmin import views from .models import EmailVerifyRecord, Banner class BaseSetting(object): enable_themes = True use_bootswatch = True class GlobalSetting(object): site_title = "慕学后台管理系统" site_footer = "慕学在线网" menu_style = "accordion" class EmailVerifyRecordAdmin(object): list_display = ['code', 'email', 'send_type', 'send_time'] search_fields = ['code', 'email', 'send_type', 'send_time'] list_filter = ['code', 'email', 'send_type', 'send_time'] class BannerAdmin(object): list_display = ['title', 'image', 'url', 'index', 'add_time'] search_fields = ['title', 'image', 'url', 'index'] list_filter = ['title', 'image', 'url', 'index', 'add_time'] xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin) xadmin.site.register(Banner, BannerAdmin) xadmin.site.register(views.BaseAdminView, BaseSetting) xadmin.site.register(views.CommAdminView, GlobalSetting)
写回答
1回答
-
宝慕林6589715
2017-08-20
这个问题老师有回答过,以下办法亲测可用:
解决:
1.安装requests
pip install requests
2./xadmin/plugins/themes.py 引入requests
import requests
3.修改block_top_navmenu,方法具体参考: https://my.oschina.net/u/2396236/blog/1083251
注意:修改xadmin的源代码之前,最好把你之前的那个themes.py文件右键Copy,然后复制备份到本地,以便下次用到,因为修改的是源码,要是哪里出问题了,将来很麻烦。
122017-09-02
相似问题