完成wordpress到django站点的数据迁移,下一届阶段完成前端样式的轻度编写

This commit is contained in:
2026-10-20 02:55:22 +08:00
parent 9592e6a150
commit 16a75807ee
30 changed files with 27989 additions and 51 deletions
+21 -1
View File
@@ -1,3 +1,23 @@
"""
Django 自带的管理后台配置
在这里注册模型后,就能在 /admin/ 里管理数据
"""
from django.contrib import admin
from .models import Post
# Register your models here.
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
"""
自定义 Post 在后台的显示方式
"""
# 列表页显示的字段
list_display = ('title', 'status', 'published_at')
# 右侧筛选器
list_filter = ('status', 'published_at')
# 顶部搜索框,搜索这些字段
search_fields = ('title', 'content')
# 输入标题时自动填充 slug(用标题的拼音/英文)
prepopulated_fields = {'slug': ('title',)}
# 列表页每页显示数量
list_per_page = 20