我只是想在一些序列化器字段中添加url。
class PageListSerializer(ModelSerializer):
slider = SerializerMethodField()
lookup_field = 'title'
class Meta:
model = Page
fields = [
'is_active',
'category',
'title',
'slug',
'bundle_section',
'login_register_section',
'user_review_section',
'slider',
'top_content',
'mini_content',
'panel_content',
]
例如,以下打印在顶部,迷你,面板内容中给出1。而不是1,我想添加网址。
“top_content”:[ 1 ] “mini_content”:[ 1 ] “panel_content”:[ 1 ]
如何使用超链接修复它?谢谢。