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

This commit is contained in:
Jeremy Stretch
2020-07-30 08:57:45 -04:00
parent 24cedab04b
commit 712e850951
2 changed files with 2 additions and 1 deletions

View File

@@ -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"
)