Django打造在线教育平台_day_3( 搭建后台管理系统Xadmin之其他app的数据表注册)

别裁伪体亲风雅,转益多师是汝师。这篇文章主要讲述Django打造在线教育平台_day_3: 搭建后台管理系统Xadmin之其他app的数据表注册相关的知识,希望能为你提供帮助。
courses/adminx.py

import xadmin from .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)

【Django打造在线教育平台_day_3( 搭建后台管理系统Xadmin之其他app的数据表注册)】operation/adminx.py
import xadmin from .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)

organization/adminx.py
import xadmin from .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)

 

    推荐阅读