多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
**xadmin 配置修改** 、安装xadmin(本机调试状态) 1、安装xadmin `pip install xadmin` 2、卸载xadmin `pip uninstall xadmin` 3、下载xadmin 最新版源码、源码、源码 下载源码拷贝至 项目根目录 4、setting.py 、urls.py 文件修改 setting.py ~~~ INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'users', 'xadmin', 'crispy_forms' ] ~~~ urls.py ~~~ #引入 xadmin 模块 from django.conf.urls import url from django.contrib import admin import xadmin urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), ] ~~~ 如果本机运行出错,查看错误是否需要安装其他模块 ~~~ pip install future pip install six pip install django-import-export ~~~ 5、生成数据表 `makemigrations` `migrate` xadmin 配置修改 guigu app项目增加文件adminx.py ~~~ #adminx样板 # _*_ coding:utf-8 _*_ __author__ = 'canmeng' __date__ = '2018/1/7 18:21' import xadmin #引入xadmin from .models import Blogs #引入当前app models类 from xadmin import views #引入xadmin views #Xadmin针对titel、footer修改 class GlobalSettings(object): site_title = "后台管理系统" site_footer = "管理系统" #右侧导航修改 #menu_style = "accordion" class BlogsAdmin(object): #展示内容 list_display = ['title', 'author', 'body', 'publish'] #搜索功能 search_fields = ['title', 'author', 'body'] #筛选功能 list_filter = ['title', 'author', 'body', 'publish'] xadmin.site.register(Blogs, BlogsAdmin) #修改xadmin后台titel、footer xadmin.site.register(views.CommAdminView, GlobalSettings) ~~~