Skip to content

Commit d5d962c

Browse files
committed
chore: enhance tool query to include user nickname
--bug=1061299 --user=刘瑞斌 【工具】编辑工具后,工具的创建者不显示了,刷新可恢复正常 https://www.tapd.cn/62980211/s/1766692
1 parent fcd6b53 commit d5d962c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/tools/serializers/tool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,8 @@ def delete(self):
515515

516516
def one(self):
517517
self.is_one_valid(raise_exception=True)
518-
tool = QuerySet(Tool).filter(id=self.data.get('id')).first()
518+
tool = QuerySet(Tool).filter(id=self.data.get('id')).select_related('user').first()
519+
nick_name = tool.user.nick_name if tool and tool.user else None
519520
if tool.init_params:
520521
tool.init_params = json.loads(rsa_long_decrypt(tool.init_params))
521522
if tool.init_field_list:
@@ -528,6 +529,7 @@ def one(self):
528529
return {
529530
**ToolModelSerializer(tool).data,
530531
'init_params': tool.init_params if tool.init_params else {},
532+
'nick_name': nick_name
531533
}
532534

533535
def export(self):

0 commit comments

Comments
 (0)