Skip to content

Enabling Must be unique on a field for which there are already Custom Objects with non-unique values fails #64

@mrmrcoleman

Description

@mrmrcoleman

Plugin Version

commit 5742679 (HEAD -> main, origin/main, origin/feature, origin/HEAD)

NetBox Version

v4.2.8-Docker-3.2.0

Python Version

3.12

Steps to Reproduce

  • Create a Custom Object Type X
  • Add a text field
  • Create a Custom Object of Type X, A with text field value blah
  • Create a Custom Object of Type X, B with text field value blah
  • Edit the Custom Object Type text field and set it to Must be unique

Expected Behavior

I'd expect to see a useful error telling me that custom objects with non unique values already exist so this action isn't permitted

Observed Behavior

<class 'django.db.utils.IntegrityError'>

could not create unique index "custom_objects_2_testtextfield_6aed7855_uniq"
DETAIL:  Key (testtextfield)=(blah) is duplicated.

Python version: 3.12.3
NetBox version: 4.2.8-Docker-3.2.0
Plugins: 
  netbox_custom_objects: 0.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions