mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: ensure unique tag IDs when creating new document tags
--bug=1062908 --user=刘瑞斌 【知识库】文档标签设置,添加标签时,重复选择相同的标签,添加报错 https://www.tapd.cn/62980211/s/1789052
This commit is contained in:
parent
d7748ac68b
commit
75d79918b8
|
|
@ -1475,7 +1475,7 @@ class DocumentSerializers(serializers.Serializer):
|
|||
id=uuid.uuid7(),
|
||||
document_id=document_id,
|
||||
tag_id=tag_id
|
||||
) for tag_id in tag_ids if tag_id not in existing_tag_ids
|
||||
) for tag_id in set(tag_ids) if tag_id not in existing_tag_ids
|
||||
]
|
||||
if new_tags:
|
||||
QuerySet(DocumentTag).bulk_create(new_tags)
|
||||
|
|
|
|||
Loading…
Reference in New Issue