From f7d0db9cd25468fbf2a97f05761f670d5974f854 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 5 Nov 2021 13:16:43 -0400 Subject: [PATCH] Fixes #7756: Fix AttributeError exception when editing an IP address assigned to a FHRPGroup --- docs/release-notes/version-3.1.md | 8 ++++++++ netbox/ipam/forms/models.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-3.1.md b/docs/release-notes/version-3.1.md index f33ee605b..df7ad3a4a 100644 --- a/docs/release-notes/version-3.1.md +++ b/docs/release-notes/version-3.1.md @@ -1,3 +1,11 @@ +## v3.1-beta2 (FUTURE) + +### Bug Fixes + +* [#7756](https://github.com/netbox-community/netbox/issues/7756) - Fix AttributeError exception when editing an IP address assigned to a FHRPGroup + +--- + ## v3.1-beta1 (2021-11-05) !!! warning "PostgreSQL 10 Required" diff --git a/netbox/ipam/forms/models.py b/netbox/ipam/forms/models.py index afbe33282..7eda3c38d 100644 --- a/netbox/ipam/forms/models.py +++ b/netbox/ipam/forms/models.py @@ -444,8 +444,8 @@ class IPAddressForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): # Initialize primary_for_parent if IP address is already assigned if self.instance.pk and self.instance.assigned_object: - parent = self.instance.assigned_object.parent_object - if ( + parent = getattr(self.instance.assigned_object, 'parent_object', None) + if parent and ( self.instance.address.version == 4 and parent.primary_ip4_id == self.instance.pk or self.instance.address.version == 6 and parent.primary_ip6_id == self.instance.pk ):