Browse Source

#8198: Fix validation bug

Jeremy Stretch 1 year ago
parent
commit
5f87724072
1 changed files with 1 additions and 1 deletions
  1. 1 1
      netbox/netbox/models/features.py

+ 1 - 1
netbox/netbox/models/features.py

@@ -289,7 +289,7 @@ class CustomFieldsMixin(models.Model):
 
             # Validate uniqueness if enforced
             if custom_fields[field_name].validation_unique and value not in CUSTOMFIELD_EMPTY_VALUES:
-                if self._meta.model.objects.filter(**{
+                if self._meta.model.objects.exclude(pk=self.pk).filter(**{
                     f'custom_field_data__{field_name}': value
                 }).exists():
                     raise ValidationError(_("Custom field '{name}' must have a unique value.").format(