diff --git a/authentik/core/api/applications.py b/authentik/core/api/applications.py index e9b77db73..e8a92e3a6 100644 --- a/authentik/core/api/applications.py +++ b/authentik/core/api/applications.py @@ -67,7 +67,7 @@ class ApplicationSerializer(ModelSerializer): class ApplicationViewSet(UsedByMixin, ModelViewSet): """Application Viewset""" - queryset = Application.objects.all() + queryset = Application.objects.all().prefetch_related("provider") serializer_class = ApplicationSerializer search_fields = [ "name", diff --git a/authentik/core/api/groups.py b/authentik/core/api/groups.py index 6ca292fcb..0e1d88346 100644 --- a/authentik/core/api/groups.py +++ b/authentik/core/api/groups.py @@ -81,7 +81,7 @@ class GroupFilter(FilterSet): class GroupViewSet(UsedByMixin, ModelViewSet): """Group Viewset""" - queryset = Group.objects.all() + queryset = Group.objects.all().select_related("parent").prefetch_related("users") serializer_class = GroupSerializer search_fields = ["name", "is_superuser"] filterset_class = GroupFilter