mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-21 03:27:21 -06:00
Limit inherited contacts to model
This commit is contained in:
parent
72adda1197
commit
ca6b686b88
@ -373,14 +373,12 @@ class ContactsMixin(models.Model):
|
||||
from tenancy.models import ContactAssignment
|
||||
from . import NestedGroupModel
|
||||
|
||||
filter = Q()
|
||||
for obj in [self]:
|
||||
filter |= Q(
|
||||
object_type=ObjectType.objects.get_for_model(obj),
|
||||
filter = Q(
|
||||
object_type=ObjectType.objects.get_for_model(self),
|
||||
object_id__in=(
|
||||
obj.get_ancestors(include_self=True).values_list('pk', flat=True)
|
||||
if (isinstance(obj, NestedGroupModel) and inherited)
|
||||
else [obj.pk]
|
||||
self.get_ancestors(include_self=True).values_list('pk', flat=True)
|
||||
if (isinstance(self, NestedGroupModel) and inherited)
|
||||
else [self.pk]
|
||||
),
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user