博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Django打造在线教育平台_day_3: 搭建后台管理系统Xadmin之其他app的数据表注册
阅读量:4959 次
发布时间:2019-06-12

本文共 3893 字,大约阅读时间需要 12 分钟。

1、courses/adminx.py

import xadminfrom .models import Course, Lesson, Video, CourseResourceclass CourseAdmin(object):    list_display = ['name', 'desc', 'detail', 'degree','learn_times', 'students','fav_nums','image','click_nums','add_time']  # 列表显示    search_fields = ['name', 'desc', 'detail', 'degree','learn_times', 'students','fav_nums','image','click_nums']   # 搜索    list_filter = ['name', 'desc', 'detail', 'degree','learn_times', 'students','fav_nums','image','click_nums','add_time']  # 筛选class LessonAdmin(object):    list_display = ['course', 'name', 'add_time']  # 列表显示    search_fields = ['course', 'name']  # 搜索    list_filter = ['course', 'name', 'add_time']   # 筛选class VideoAdmin(object):    list_display = ['lesson', 'name', 'add_time']  # 列表显示    search_fields = ['lesson', 'name']  # 搜索    list_filter = ['lesson', 'name', 'add_time']   # 筛选class CourseResourceAdmin(object):    list_display = ['course', 'name', 'add_time','download']  # 列表显示    search_fields = ['course', 'name','download']  # 搜索    list_filter = ['course', 'name', 'add_time','download']   # 筛选xadmin.site.register(Lesson, LessonAdmin)xadmin.site.register(Course, CourseAdmin)xadmin.site.register(Video, VideoAdmin)xadmin.site.register(CourseResource, CourseResourceAdmin)

2、operation/adminx.py

import xadminfrom .models import UserAsk, CourseComments, UserFavorite, UserMessage, UserCourseclass UserAskAdmin(object):    list_display = ['name', 'mobile', 'course_name','add_time']  # 列表显示    search_fields = ['name', 'mobile', 'course_name'] # 搜索    list_filter = ['name', 'mobile', 'course_name','add_time']  # 筛选class CourseCommentsAdmin(object):    list_display = ['user', 'course', 'comments','add_time']  # 列表显示    search_fields = ['user', 'course', 'comments']   # 搜索    list_filter = ['user', 'course', 'comments','add_time']   # 筛选class UserFavoriteAdmin(object):    list_display = ['user', 'fav_id', 'fav_type','add_time']  # 列表显示    search_fields = ['user', 'fav_id', 'fav_type'] # 搜索    list_filter = ['user', 'fav_id', 'fav_type','add_time']  # 筛选class UserMessageAdmin(object):    list_display = ['user', 'message', 'has_read','add_time']  # 列表显示    search_fields = ['user', 'message', 'has_read'] # 搜索    list_filter = ['user', 'message', 'has_read','add_time']   # 筛选class UserCourseAdmin(object):    list_display = ['user', 'course', 'add_time']  # 列表显示    search_fields = ['user', 'course']   # 搜索    list_filter = ['user', 'course', 'add_time']    # 筛选xadmin.site.register(UserAsk, UserAskAdmin)xadmin.site.register(CourseComments, CourseCommentsAdmin)xadmin.site.register(UserFavorite, UserFavoriteAdmin)xadmin.site.register(UserMessage, UserMessageAdmin)xadmin.site.register(UserCourse, UserCourseAdmin)

3、organization/adminx.py

import xadminfrom .models import CityDict, CourseOrg, Teacherclass CityDictAdmin(object):    list_display = ['name', 'desc','add_time']  # 列表显示    search_fields = ['name', 'desc']  # 搜索    list_filter = ['name', 'desc','add_time']    # 筛选class CourseOrgAdmin(object):    list_display = ['city', 'name','desc','click_nums','fav_nums','image','address','add_time']  # 列表显示    search_fields = ['city', 'name','desc','click_nums','fav_nums','image','address']   # 搜索    list_filter = ['city', 'name','desc','click_nums','fav_nums','image','address','add_time']     # 筛选class TeacherAdmin(object):    list_display = ['org', 'name','work_years','work_company','work_position','points','click_nums','fav_nums','add_time']  # 列表显示    search_fields = ['org', 'name','work_years','work_company','work_position','points','click_nums','fav_nums']  # 搜索    list_filter = ['org', 'name','work_years','work_company','work_position','points','click_nums','fav_nums','add_time']    # 筛选xadmin.site.register(CityDict, CityDictAdmin)xadmin.site.register(CourseOrg, CourseOrgAdmin)xadmin.site.register(Teacher, TeacherAdmin)

 

转载于:https://www.cnblogs.com/jp-mao/p/7072971.html

你可能感兴趣的文章
ASP.NET导出word实例
查看>>
关于label和input对齐的那些事
查看>>
noip2011普及组T2 统计单词数(stat) KMP算法
查看>>
《性能测试进价指南LoadRunner11.0》——读书笔记
查看>>
ulimit 修改 open files & core
查看>>
学习Smarty3要点记录+顶级页面模板代码:
查看>>
webRTC-实时流媒体的福音
查看>>
C#:构造函数
查看>>
Hibernate总结
查看>>
双目立体匹配中的核线约束[极线约束]
查看>>
DICOM:DICOM3.0网络通信协议(续)
查看>>
打一辈子的工才是最大的风险
查看>>
阿里云Ubuntu部署java web(2) - 配置tomcat
查看>>
利用:before和:after伪类制作CSS3 圆形按钮 含demo
查看>>
iOS10 openURL方法跳转到设置界面
查看>>
2019金融科技风往哪儿吹?蚂蚁金服联合20余家金融机构预测新年热点:5G、区块链上榜...
查看>>
使用Snappy 压缩方式报错“java.lang.UnsatisfiedLinkError: no snappyjava in java.library.path”...
查看>>
(后端)Spring Boot自定义错误页面,Whitelabel Error Page处理方式(转)
查看>>
HDU 3549 Flow Problem
查看>>
平时二十五测
查看>>