From 712e8509511c16746b087f98345c5abdd9efe874 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 30 Jul 2020 08:57:45 -0400 Subject: [PATCH] Fixes #4927: Fix validation error when updating an existing secret --- docs/release-notes/version-2.8.md | 1 + netbox/secrets/forms.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.8.md b/docs/release-notes/version-2.8.md index 082129e88..7a39c876a 100644 --- a/docs/release-notes/version-2.8.md +++ b/docs/release-notes/version-2.8.md @@ -16,6 +16,7 @@ * [#4894](https://github.com/netbox-community/netbox/issues/4894) - Fix display of device/VM counts on platforms list * [#4895](https://github.com/netbox-community/netbox/issues/4895) - Force UTF-8 encoding when embedding model documentation * [#4910](https://github.com/netbox-community/netbox/issues/4910) - Unpin redis dependency to fix exception in RQ worker +* [#4927](https://github.com/netbox-community/netbox/issues/4927) - Fix validation error when updating an existing secret * [#4929](https://github.com/netbox-community/netbox/issues/4929) - Correct log message when creating a new object --- diff --git a/netbox/secrets/forms.py b/netbox/secrets/forms.py index 296469900..b4fe4eaff 100644 --- a/netbox/secrets/forms.py +++ b/netbox/secrets/forms.py @@ -120,7 +120,7 @@ class SecretForm(BootstrapMixin, CustomFieldModelForm): device=self.cleaned_data['device'], role=self.cleaned_data['role'], name=self.cleaned_data['name'] - ).exists(): + ).exclude(pk=self.instance.pk).exists(): raise forms.ValidationError( "Each secret assigned to a device must have a unique combination of role and name" )