Optimize contact lookup query

This commit is contained in:
Alexander Haase 2025-02-25 18:36:16 +01:00
parent ca6b686b88
commit effc23f5bb

View File

@ -376,7 +376,7 @@ class ContactsMixin(models.Model):
filter = Q(
object_type=ObjectType.objects.get_for_model(self),
object_id__in=(
self.get_ancestors(include_self=True).values_list('pk', flat=True)
self.get_ancestors(include_self=True)
if (isinstance(self, NestedGroupModel) and inherited)
else [self.pk]
),