From bb6b9e6f6e5e5916dd3fa38e9c797920c91753ea Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 24 Aug 2022 19:32:49 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA=20?= =?UTF-8?q?platform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/perms/apps.py | 2 +- apps/users/serializers/group.py | 4 +--- utils/generate_fake_data/resources/assets.py | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/perms/apps.py b/apps/perms/apps.py index 432c194cd..f9d1e6f42 100644 --- a/apps/perms/apps.py +++ b/apps/perms/apps.py @@ -10,5 +10,5 @@ class PermsConfig(AppConfig): def ready(self): super().ready() - from . import signal_handlers + # from . import signal_handlers from . import notifications diff --git a/apps/users/serializers/group.py b/apps/users/serializers/group.py index 1638a5b91..6f75b402a 100644 --- a/apps/users/serializers/group.py +++ b/apps/users/serializers/group.py @@ -47,7 +47,5 @@ class UserGroupSerializer(BulkOrgResourceModelSerializer): @classmethod def setup_eager_loading(cls, queryset): """ Perform necessary eager loading of data. """ - queryset = queryset.prefetch_related( - Prefetch('users', queryset=User.objects.only('id')) - ).annotate(users_amount=Count('users')) + queryset = queryset.prefetch_related('users').annotate(users_amount=Count('users')) return queryset diff --git a/utils/generate_fake_data/resources/assets.py b/utils/generate_fake_data/resources/assets.py index 6e1ad8cab..df4703dc1 100644 --- a/utils/generate_fake_data/resources/assets.py +++ b/utils/generate_fake_data/resources/assets.py @@ -34,8 +34,8 @@ class PlatformGenerator(FakeDataGenerator): tp = choice(self.category_type[category].choices) data = { 'name': forgery_py.name.company_name(), - 'category': choice(self.categories), - 'type': tp + 'category': category, + 'type': tp[0] } platforms.append(Platform(**data)) Platform.objects.bulk_create(platforms, ignore_conflicts=True)