diff --git a/apps/accounts/serializers/account/account.py b/apps/accounts/serializers/account/account.py index 42fc8f898..a06a11fd6 100644 --- a/apps/accounts/serializers/account/account.py +++ b/apps/accounts/serializers/account/account.py @@ -119,7 +119,7 @@ class AccountSerializer(AccountSerializerCreateMixin, BaseAccountSerializer): def setup_eager_loading(cls, queryset): """ Perform necessary eager loading of data. """ queryset = queryset \ - .prefetch_related('asset', 'asset__platform') + .prefetch_related('asset', 'asset__platform', 'asset__platform__automation') return queryset diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index c5a9ed02d..c4f2a5da7 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -136,6 +136,7 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali read_only_fields = [ 'category', 'type', 'connectivity', 'date_verified', 'created_by', 'date_created', + 'auto_info', ] fields = fields_small + fields_fk + fields_m2m + read_only_fields extra_kwargs = { @@ -182,10 +183,10 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali @classmethod def setup_eager_loading(cls, queryset): """ Perform necessary eager loading of data. """ - queryset = queryset.prefetch_related('domain', 'platform') \ + queryset = queryset.prefetch_related('domain', 'nodes', 'labels', 'protocols') \ + .prefetch_related('platform', 'platform__automation') \ .annotate(category=F("platform__category")) \ .annotate(type=F("platform__type")) - queryset = queryset.prefetch_related('nodes', 'labels', 'protocols') return queryset @staticmethod