完成wordpress到django站点的数据迁移,下一届阶段完成前端样式的轻度编写
This commit is contained in:
+21
-1
@@ -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
|
||||
Reference in New Issue
Block a user