Skip to content

Commit 75d7991

Browse files
committed
fix: ensure unique tag IDs when creating new document tags
--bug=1062908 --user=刘瑞斌 【知识库】文档标签设置,添加标签时,重复选择相同的标签,添加报错 https://www.tapd.cn/62980211/s/1789052
1 parent d7748ac commit 75d7991

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/knowledge/serializers/document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ def add_tags(self):
14751475
id=uuid.uuid7(),
14761476
document_id=document_id,
14771477
tag_id=tag_id
1478-
) for tag_id in tag_ids if tag_id not in existing_tag_ids
1478+
) for tag_id in set(tag_ids) if tag_id not in existing_tag_ids
14791479
]
14801480
if new_tags:
14811481
QuerySet(DocumentTag).bulk_create(new_tags)

0 commit comments

Comments
 (0)