mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Fixes #9884: Prevent querying assigned VRF on prefix object init
This commit is contained in:
parent
9fe5f09742
commit
8a075bcff9
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#9884](https://github.com/netbox-community/netbox/issues/9884) - Prevent querying assigned VRF on prefix object init
|
||||||
* [#9891](https://github.com/netbox-community/netbox/issues/9891) - Ensure consistent ordering for tags during object serialization
|
* [#9891](https://github.com/netbox-community/netbox/issues/9891) - Ensure consistent ordering for tags during object serialization
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -373,7 +373,7 @@ class Prefix(GetAvailablePrefixesMixin, NetBoxModel):
|
|||||||
|
|
||||||
# Cache the original prefix and VRF so we can check if they have changed on post_save
|
# Cache the original prefix and VRF so we can check if they have changed on post_save
|
||||||
self._prefix = self.prefix
|
self._prefix = self.prefix
|
||||||
self._vrf = self.vrf
|
self._vrf_id = self.vrf_id
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.prefix)
|
return str(self.prefix)
|
||||||
|
@ -30,14 +30,14 @@ def update_children_depth(prefix):
|
|||||||
def handle_prefix_saved(instance, created, **kwargs):
|
def handle_prefix_saved(instance, created, **kwargs):
|
||||||
|
|
||||||
# Prefix has changed (or new instance has been created)
|
# Prefix has changed (or new instance has been created)
|
||||||
if created or instance.vrf != instance._vrf or instance.prefix != instance._prefix:
|
if created or instance.vrf_id != instance._vrf_id or instance.prefix != instance._prefix:
|
||||||
|
|
||||||
update_parents_children(instance)
|
update_parents_children(instance)
|
||||||
update_children_depth(instance)
|
update_children_depth(instance)
|
||||||
|
|
||||||
# If this is not a new prefix, clean up parent/children of previous prefix
|
# If this is not a new prefix, clean up parent/children of previous prefix
|
||||||
if not created:
|
if not created:
|
||||||
old_prefix = Prefix(vrf=instance._vrf, prefix=instance._prefix)
|
old_prefix = Prefix(vrf_id=instance._vrf_id, prefix=instance._prefix)
|
||||||
update_parents_children(old_prefix)
|
update_parents_children(old_prefix)
|
||||||
update_children_depth(old_prefix)
|
update_children_depth(old_prefix)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user