Forráskód Böngészése

Fixes #4927: Fix validation error when updating an existing secret

Jeremy Stretch 5 éve
szülő
commit
712e850951
2 módosított fájl, 2 hozzáadás és 1 törlés
  1. 1 0
      docs/release-notes/version-2.8.md
  2. 1 1
      netbox/secrets/forms.py

+ 1 - 0
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
 
 ---

+ 1 - 1
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"
             )