内置后台
对应<app_name>/admin.py
添加model到Admin
# polls/admin.py
help_text = '<strong>bold test</strong>'
@admin.register(Polls)
class PollsAdmin(admin.ModelAdmin):
list_display = ('name','updated')
search_fields = ['name']
fieldsets = [
('Content', {'fields': ['name'],'description':f'<div class="help">{help_text}</div>'}),
]
# 把Save and add another 替换为 Save as new
save_as = True
# 去掉 "增加" 按钮
def has_add_permission(self, request):
return False
# admin.site.register(Polls, PollsAdmin)