Skip to content

Warning on unique object type fields #230

@sleepinggenius2

Description

@sleepinggenius2

Plugin Version

0.3.1

NetBox Version

4.4.1

Python Version

3.12

Steps to Reproduce

  1. Create a custom object type
    • Internal name = "test"
    • URL path/slug = "test"
  2. Add Field
    • Name = "device"
    • Type = Object
    • Must be unique = True
    • Related object type = DCIM > Device
  3. Start the NetBox service using manage.py runserver

Expected Behavior

Service should start up cleanly with no errors or warnings.

Observed Behavior

The following appears on the console at startup:

Watching for file changes with StatReloader
Performing system checks...

System check identified some issues:

WARNINGS:
netbox_custom_objects.Table1Model.device: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
	HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
netbox_custom_objects.Table1Model.device: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
	HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions