mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-21 11:37:21 -06:00
Optimize contact lookup query
This commit is contained in:
parent
ca6b686b88
commit
effc23f5bb
@ -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]
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user