2024-06-08 00:54:15 发布
网友
在models.py中
description = models.RichTextField
在admin.py中
list_display = ['description']
I管理面板说明如下所示:
<p><strong>bold description: </strong>adding a description</p>
预期的结果是: 粗体描述:添加描述
Django初学者在此方面的帮助将不胜感激
您可以使用format_html将内容标记为安全的
from django.utils.html import format_html class MyModelAdmin(admin.ModelAdmin): ... list_display = ['get_description', ] def get_description(self, obj): return format_html(obj) get_description.short_description = 'description'
您可以使用format_html将内容标记为安全的
相关问题 更多 >
编程相关推荐