From 5f59c729b7433045e135fdf67cb1a341ce7deeaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=B9=BF?= Date: Mon, 22 Jul 2019 11:38:09 +0800 Subject: [PATCH] Perm for assets (#3003) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Update] 授权显示节点下所有的资产 * [Update] 修改返回资产的comment * [Update] 修改节点返回字段 --- apps/assets/serializers/node.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/assets/serializers/node.py b/apps/assets/serializers/node.py index ea4aa7355..29c2d7f55 100644 --- a/apps/assets/serializers/node.py +++ b/apps/assets/serializers/node.py @@ -14,13 +14,14 @@ __all__ = [ class NodeSerializer(BulkOrgResourceModelSerializer): assets_amount = serializers.IntegerField(read_only=True) + name = serializers.ReadOnlyField(source='value') class Meta: model = Node only_fields = ['id', 'key', 'value', 'org_id'] - fields = only_fields + ['assets_amount'] + fields = only_fields + ['name', 'assets_amount'] read_only_fields = [ - 'key', 'assets_amount', 'org_id', + 'key', 'name', 'assets_amount', 'org_id', ] def validate_value(self, data):