From dd854484512744fef42b75714598250e023460b4 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 2 Jan 2020 09:26:38 -0500 Subject: [PATCH] Fixes #3822: Fix exception when editing a device bay (regression from #3596) --- docs/release-notes/version-2.6.md | 1 + netbox/dcim/models.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 36afbc3e2..4e26ffab4 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -17,6 +17,7 @@ * [#3780](https://github.com/netbox-community/netbox/issues/3780) - Fix AttributeError exception in API docs * [#3809](https://github.com/netbox-community/netbox/issues/3809) - Filter platform by manufacturer when editing devices * [#3811](https://github.com/netbox-community/netbox/issues/3811) - Fix filtering of racks by group on device list +* [#3822](https://github.com/netbox-community/netbox/issues/3822) - Fix exception when editing a device bay (regression from #3596) --- diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index db88901b6..6d3de7c0b 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -2597,7 +2597,7 @@ class DeviceBay(ComponentModel): # Check that the installed device is not already installed elsewhere if self.installed_device: current_bay = DeviceBay.objects.filter(installed_device=self.installed_device).first() - if current_bay: + if current_bay != self: raise ValidationError({ 'installed_device': "Cannot install the specified device; device is already installed in {}".format( current_bay