Skip to content

Custom Object Type listed twice in "Related Objects" panel of the target object (e.g. Tenant) – 0.7.0 / NetBox 4.7.3 #841

Open

Description

@mrgromdd

Plugin Version

0.7.0

NetBox Version

4.7.3

Python Version

3.12

Steps to Reproduce

  1. Create a Custom Object Type (e.g. tstcorp_lines) with an Object field pointing to tenancy.tenant.
  2. Create at least one custom object linked to a Tenant.
  3. Open that Tenant's page.

Expected Behavior

The type is listed once, like any regular related model (IP addresses, VLANs, ...).

Observed Behavior

The "Related Objects" panel on the Tenant page lists the custom object type twice (two identical rows, same count). No errors in the logs. Still reproducible on 0.7.0 even though the new "Custom Objects" tab exists. Same symptom as #594 (0.5.2 / NetBox 4.6.3), which was expected to be superseded by the tab, but the legacy panel row is still duplicated.

Image

Suspected Cause

Tenant._meta.related_objects contains the same reverse relation twice. In netbox_custom_objects/init.py, CustomObjectsPluginConfig.get_models() (around line 637 in 0.7.0) yields the dynamically generated model twice, so the app registry sees the model twice. Related: #383 (same symptom, fixed in 0.4.7), #688, #755.

Proposed Fix

Deduplicate the models yielded by get_models() (e.g. by _meta.label_lower). Alternatively, exclude custom object types from the legacy Related Objects panel now that the Custom Objects tab covers them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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