class CourseOrgAdmin(object): obj = org.CourseOrg list_display = get_list_display(obj) search_fields = get_search_fields(obj) list_filter = get_list_display(obj) # 当有个外键指向他的时候,以搜索模式 relfield_style = 'fx-ajax'
class CourseAdmin(object): obj = course.Course list_display = [ 'name', 'id', 'course_org', 'teacher', 'desc', 'degree', 'click_num' ] search_fields = get_search_fields(obj) list_filter = get_list_display(obj) # 显示排序 ordering = ['-click_num'] # 只读字段 readonly_fields = ['click_num'] # 去除字段显示 exclude = ['favourite_mun'] # icon model_icon = 'fa fa-group' style_fields = {'detail': 'ueditor'} import_excel = True inlines = [LessonInline, CourseResourseInline] def post(self, request, *args, **kwargs): if 'excel' in request.FILES: pass return super(CourseAdmin, self).post(request, args, kwargs)
class UserCourseAdmin(object): obj = operation.UserCourse list_display = get_list_display(obj) search_fields = get_search_fields(obj) list_filter = get_list_display(obj)
class CourseCommentsAdmin(object): obj = operation.CourseComments list_display = get_list_display(obj) search_fields = get_search_fields(obj) list_filter = get_list_display(obj)
class CourseResourceAdmin(object): obj = course.CourseResource list_display = get_list_display(obj) search_fields = get_search_fields(obj) list_filter = get_list_display(obj)
class VideoAdmin(object): obj = course.Video list_display = get_list_display(obj) search_fields = get_search_fields(obj) list_filter = get_list_display(obj)
class LessonAdmin(object): obj = course.Lesson list_display = get_list_display(obj) search_fields = get_search_fields(obj) list_filter = get_list_display(obj)
class CityDictAdmin(object): obj = org.CityDict list_display = get_list_display(obj) search_fields = get_search_fields(obj) list_filter = get_list_display(obj)
class TeacherAdmin(object): obj = org.Teacher list_display = get_list_display(obj) search_fields = get_search_fields(obj) list_filter = get_list_display(obj)