From 220ccda04d6f09dfdf7ac42ab4b8aa2b3de47cdf Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 16 Jun 2020 17:55:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9domain=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=9A=84assets=E4=B8=8D=E6=98=AF=E5=BF=85=E5=A1=AB?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/serializers/domain.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/assets/serializers/domain.py b/apps/assets/serializers/domain.py index 26f1b43f5..64c5eae66 100644 --- a/apps/assets/serializers/domain.py +++ b/apps/assets/serializers/domain.py @@ -15,11 +15,18 @@ class DomainSerializer(BulkOrgResourceModelSerializer): class Meta: model = Domain - fields = [ - 'id', 'name', 'asset_count', 'gateway_count', 'comment', 'assets', - 'date_created' + fields_mini = ['id', 'name'] + fields_small = fields_mini + [ + 'comment', 'date_created' + ] + fields_m2m = [ + 'asset_count', 'assets', 'gateway_count', ] - read_only_fields = ( 'asset_count', 'gateway_count', 'date_created') + fields = fields_small + fields_m2m + read_only_fields = ('asset_count', 'gateway_count', 'date_created') + extra_kwargs = { + 'assets': {'required': False} + } list_serializer_class = AdaptedBulkListSerializer @staticmethod