From a8c9d87a5cbab75ef815945183501abf67199524 Mon Sep 17 00:00:00 2001 From: Arthur Date: Wed, 24 May 2023 16:55:43 -0700 Subject: [PATCH] 12552 test fixes --- netbox/dcim/signals.py | 2 +- netbox/utilities/tests/test_filters.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/netbox/dcim/signals.py b/netbox/dcim/signals.py index b27fcf29a..a934dbcd0 100644 --- a/netbox/dcim/signals.py +++ b/netbox/dcim/signals.py @@ -22,8 +22,8 @@ def handle_location_site_change(instance, created, **kwargs): object instead of calling update() on the QuerySet to ensure the proper change records get created for each. """ if not created: - instance.descendants().update(site=instance.site) locations = instance.descendants(include_self=True).values_list('pk', flat=True) + Location.objects.filter(pk__in=locations).update(site=instance.site) Rack.objects.filter(location__in=locations).update(site=instance.site) Device.objects.filter(location__in=locations).update(site=instance.site) PowerPanel.objects.filter(location__in=locations).update(site=instance.site) diff --git a/netbox/utilities/tests/test_filters.py b/netbox/utilities/tests/test_filters.py index 334f270dc..e545c4a93 100644 --- a/netbox/utilities/tests/test_filters.py +++ b/netbox/utilities/tests/test_filters.py @@ -2,7 +2,7 @@ import django_filters from django.conf import settings from django.db import models from django.test import TestCase -from mptt.fields import TreeForeignKey +from tree_queries.fields import TreeNodeForeignKey from taggit.managers import TaggableManager from dcim.choices import * @@ -94,7 +94,7 @@ class DummyModel(models.Model): integerfield = models.IntegerField() macaddressfield = MACAddressField() timefield = models.TimeField() - treeforeignkeyfield = TreeForeignKey( + treeforeignkeyfield = TreeNodeForeignKey( to='self', on_delete=models.CASCADE )