From 0e7e499a1ecd8db3a31781e960c6b90f359b008c Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 5 Dec 2023 15:14:45 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=20labels=20=E5=88=9B?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/serializers/mixin.py | 2 +- apps/labels/serializers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/common/serializers/mixin.py b/apps/common/serializers/mixin.py index 1a749f6d3..d51849f07 100644 --- a/apps/common/serializers/mixin.py +++ b/apps/common/serializers/mixin.py @@ -394,7 +394,7 @@ class CommonBulkModelSerializer(CommonBulkSerializerMixin, serializers.ModelSeri class ResourceLabelsMixin(serializers.Serializer): - labels = LabelRelatedField(many=True, label=_('Labels'), ) + labels = LabelRelatedField(many=True, label=_('Labels'), required=False, allow_null=True) def update(self, instance, validated_data): labels = validated_data.pop('labels', None) diff --git a/apps/labels/serializers.py b/apps/labels/serializers.py index 476b3c06f..157afc92e 100644 --- a/apps/labels/serializers.py +++ b/apps/labels/serializers.py @@ -13,7 +13,7 @@ __all__ = ['LabelSerializer', 'LabeledResourceSerializer', 'ContentTypeResourceS class LabelSerializer(BulkOrgResourceModelSerializer): class Meta: model = Label - fields = ['id', 'name', 'value', 'res_count', 'date_created', 'date_updated'] + fields = ['id', 'name', 'value', 'res_count', 'comment', 'date_created', 'date_updated'] read_only_fields = ('date_created', 'date_updated', 'res_count') extra_kwargs = { 'res_count': {'label': _('Resource count')},