Unverified Commit 5f59c729 authored by 老广's avatar 老广 Committed by GitHub

Perm for assets (#3003)

* [Update] 授权显示节点下所有的资产

* [Update] 修改返回资产的comment

* [Update] 修改节点返回字段
parent a8af4e88
...@@ -14,13 +14,14 @@ __all__ = [ ...@@ -14,13 +14,14 @@ __all__ = [
class NodeSerializer(BulkOrgResourceModelSerializer): class NodeSerializer(BulkOrgResourceModelSerializer):
assets_amount = serializers.IntegerField(read_only=True) assets_amount = serializers.IntegerField(read_only=True)
name = serializers.ReadOnlyField(source='value')
class Meta: class Meta:
model = Node model = Node
only_fields = ['id', 'key', 'value', 'org_id'] only_fields = ['id', 'key', 'value', 'org_id']
fields = only_fields + ['assets_amount'] fields = only_fields + ['name', 'assets_amount']
read_only_fields = [ read_only_fields = [
'key', 'assets_amount', 'org_id', 'key', 'name', 'assets_amount', 'org_id',
] ]
def validate_value(self, data): def validate_value(self, data):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment