首页 Django项目开发与部署视频教程 admin后台显示字段配置和富文本配置
pay pay

admin后台显示字段配置和富文本配置

日期: 六月 25, 2023, 9:50 a.m.
阅读: 136
作者: Python自学网-村长

摘要: admin后台显示字段配置和富文本配置

admin后台显示字段配置和富文本配置

from django.contrib import admin
from . models import Art_List, Art, Download_List, Download, Video_List, Video, User, Tags, Page

admin.site.site_header = 'Python自学网 - 实战案例'
admin.site.site_title = 'myblog'
admin.site.index_title = 'myblog数据表'


@admin.register(Art_List)
class Art_ListAdmin(admin.ModelAdmin):
    list_display = ['id', 'art_list_title', 'art_list_short_title', 'art_list_tail', 'art_list_click', 'art_list_img', 'is_delete']
    list_filter = ['art_list_title']
    list_display_links = ('art_list_title',)


@admin.register(Art)
class ArtAdmin(admin.ModelAdmin):
    list_display = ['id', 'art_title', 'art_short_title', 'art_keyword', 'art_tail', 'art_click',
                    'art_time', 'art_img', 'art_top_list', 'art_del']
    list_filter = ['art_title']
    list_display_links = ('art_title',)


@admin.register(Download_List)
class Download_ListAdmin(admin.ModelAdmin):
    list_display = ['id', 'down_col_title', 'down_col_short_title', 'down_col_keyword', 'down_col_click', 'is_delete']
    list_filter = ['down_col_title']
    list_display_links = ('down_col_title',)


@admin.register(Download)
class DownloadAdmin(admin.ModelAdmin):
    list_display = ['id', 'down_title', 'down_tail', 'down_click', 'down_time', 'down_img',
                    'down_ico', 'down_limit', 'down_order', 'down_class', 'is_delete']
    list_filter = ['down_title']
    list_display_links = ('down_title',)


@admin.register(Video_List)
class Video_ListAdmin(admin.ModelAdmin):
    list_display = ['id', 'video_list_title', 'video_list_short_title', 'video_list_keyword', 'video_list_order', 'is_delete']
    list_filter = ['video_list_title']
    list_display_links = ('video_list_title',)


@admin.register(Video)
class VideoAdmin(admin.ModelAdmin):
    list_display = ['id', 'video_title', 'video_short_title', 'video_keyword', 'video_order', 'video_author', 'video_tail',
                    'video_click', 'video_time', 'video_link', 'video_vip_link', 'video_long', 'video_img', 'video_top_list', 'is_delete']
    list_filter = ['video_title']
    list_display_links = ('video_title',)


@admin.register(User)
class UserAdmin(admin.ModelAdmin):
    list_display = ['id', 'user_name', 'user_tel', 'user_mail', 'is_activate', 'vip_statu', 'user_register_time',
                    'user_vip_time', 'is_delete']
    list_filter = ['user_name']
    list_display_links = ('user_name',)


@admin.register(Page)
class PageAdmin(admin.ModelAdmin):
    list_display = ['id', 'page_title', 'page_keyword', 'page_tail', 'page_click', 'is_delete']
    list_filter = ['page_title']
    list_display_links = ('page_title',)


@admin.register(Tags)
class TagsAdmin(admin.ModelAdmin):
    list_display = ['id', 'tag_title', 'tag_keyword', 'tag_tail', 'tag_click', 'is_delete']
    list_per_page = 20
    search_fields = ['tag_title']
    list_display_links = ('id', 'tag_title')

 

原创视频,版权所有,未经允许,切勿转载,违者必究!
回顶部