问题:
~~~
ProgrammingError at /xadmin/
(1146, "Table 'newmxonline.xadmin_usersettings' doesn't exist")
~~~
需要更新一下数据库:
~~~
makemigrations
migrate
~~~
设置主题:
~~~
from xadmin import views
class BaseSetting(object):
enable_themes = True
use_bootswatch=True
xadmin.site.register(views.BaseAdminView,BaseSetting)
~~~
修改左上角及foot:
~~~
class GlobalSettings(object):
site_title = "墨雪后台管理系统"
site_footer = "墨雪在线网"
menu_style = "accordion" #左侧导航条修改可折叠
xadmin.site.register(views.CommAdminView,GlobalSettings)
~~~
修改左侧导航条app显示为中文:
1、对应app下的apps.py添加:
`verbose_name = "app中文名"`
2、对应app下的__init__.py添加:
`default_app_config = "app名.apps.(apps.py里的class)"`
xadmin的菜单折叠
` menu_style = "accordion"`
设置models的全局图标
和上面修改title和footer一样,在类GlobalSetting 中添加:
~~~
global_models_icon = {
V_UserInfo: "glyphicon glyphicon-user", UserDistrict: "fa fa-cloud"
} # 设置models的全局图标
~~~