1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| import xadmin
from .models import UserMessage, UserAsk, UserCourse, UserFavorite, CourseCommets
class UserMessageAdmin(object): list_display = ['user', 'message', 'has_read', 'add_time'] list_filter = ['user', 'message', 'has_read', 'add_time'] search_fields = ['user', 'message']
class UserAskAdmin(object): list_display = ['name', 'mobile', 'course_name', 'add_time'] list_filter = ['name', 'mobile', 'course_name', 'add_time'] search_fields = ['name', 'mobile', 'course_name']
class UserFavoriteAdmin(object): list_display = ['user', 'course', 'fav_id', 'fav_type', 'add_time'] list_filter = ['user', 'course', 'fav_id', 'fav_type', 'add_time'] search_fields = ['user', 'course']
class CourseCommetsAdmin(object): list_display = ['user', 'course', 'comment', 'add_time'] list_filter = ['user', 'course', 'comment', 'add_time'] search_fields = ['user', 'course', 'comment']
class UserCourseAdmin(object): list_display = ['user', 'course', 'add_time'] list_filter = ['user', 'course', 'add_time'] search_fields = ['user', 'course']
xadmin.site.register(UserFavorite, UserFavoriteAdmin) xadmin.site.register(UserCourse, UserCourseAdmin) xadmin.site.register(UserAsk, UserAskAdmin) xadmin.site.register(UserMessage, UserMessageAdmin) xadmin.site.register(CourseCommets, CourseCommetsAdmin)
|