diff --git a/iaso/api/profiles/profiles.py b/iaso/api/profiles/profiles.py index 6e284f1c61..ab6004a88a 100644 --- a/iaso/api/profiles/profiles.py +++ b/iaso/api/profiles/profiles.py @@ -266,6 +266,7 @@ def list(self, request): queryset = queryset.prefetch_related( "user", "user_roles", + "user__tenant_user", "org_units", "org_units__version", "org_units__version__data_source", diff --git a/iaso/tests/api/test_profiles.py b/iaso/tests/api/test_profiles.py index 768068429f..841e07580b 100644 --- a/iaso/tests/api/test_profiles.py +++ b/iaso/tests/api/test_profiles.py @@ -296,7 +296,7 @@ def test_profile_list_read_only_permissions(self): """GET /profiles/ with auth (user has read only permissions)""" self.client.force_authenticate(self.jane) - with self.assertNumQueries(11): + with self.assertNumQueries(12): response = self.client.get("/api/profiles/") self.assertJSONResponse(response, 200) profile_url = "/api/profiles/%s/" % self.jane.iaso_profile.id