perf: tags update

pull/13410/head
ibuler 2024-06-12 16:19:16 +08:00
parent cd1f6a9137
commit 7be6cf2b73
3 changed files with 14 additions and 3 deletions

View File

@ -122,11 +122,17 @@ class LabelRelatedField(serializers.RelatedField):
from labels.models import LabeledResource, Label
if data is None:
return data
if isinstance(data, dict):
if isinstance(data, dict) and data.get("id"):
pk = data.get("id") or data.get("pk")
label = Label.objects.get(pk=pk)
else:
if isinstance(data, dict):
k = data.get("name")
v = data.get("value")
elif isinstance(data, str) and ":" in data:
k, v = data.split(":", 1)
else:
raise serializers.ValidationError(_("Invalid data type"))
label, __ = Label.objects.get_or_create(name=k, value=v, defaults={'name': k, 'value': v})
return LabeledResource(label=label)

View File

@ -408,7 +408,7 @@
"Disable": "Disable",
"DisableSelected": "Disable selected",
"DisplayName": "Name",
"Docs": "Document",
"Docs": "Docs",
"Download": "Download",
"DownloadCenter": "Download",
"DownloadFTPFileTip": "The current action does not record files, or the file size exceeds the threshold (default 100m), or it has not yet been saved to the corresponding storage",

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 14 KiB