Skip to content

[WIP] Related object tabs — PoC for discussion#434

Draft
Kani999 wants to merge 3 commits intonetboxlabs:mainfrom
Kani999:feature/related-object-tabs
Draft

[WIP] Related object tabs — PoC for discussion#434
Kani999 wants to merge 3 commits intonetboxlabs:mainfrom
Kani999:feature/related-object-tabs

Conversation

@Kani999
Copy link
Copy Markdown

@Kani999 Kani999 commented Mar 26, 2026

Summary

This is a Proof of Concept / Work in Progress — not ready for merge. The design and configuration approach need discussion before finalizing.

Integrates the standalone netbox-custom-objects-tab plugin into core netbox-custom-objects (ref: CESNET/netbox-custom-objects-tab#8).

Closes #26

What's implemented

  • Combined "Custom Objects" tab — automatically appears on detail pages of any NetBox object referenced by a Custom Object Type. Shows all linked custom objects with actions, tags, column config, and quick search. Always active, no configuration needed.
  • Per-COT typed tabs — opt-in dedicated tabs for specific Custom Object Types, with type-specific columns, per-field filters, and bulk actions. Configured via typed_tab_slugs in PLUGINS_CONFIG.
  • CO-to-CO support — custom objects referencing other custom objects also get tabs.
  • Plugin wiring (__init__.py), templates, and README documentation.

Open questions for discussion

  • Configuration approach: Currently typed tabs are enabled via typed_tab_slugs list in PLUGINS_CONFIG. Is this the right UX, or should this be a per-COT toggle in the admin UI?
  • Badge/count behavior: Badges use OR + distinct queries to avoid double-counting — are there performance concerns at scale?
  • Template/styling: Do the tab templates align with NetBox core conventions, or do they need adjustment?

Commits

  1. 1cac046 — Add related object tab views and templates
  2. ab29d56 — Wire tab registration into plugin and fix pre-existing view bugs
  3. 69c46a7 — Document related object tabs in README

Images

obrazek obrazek obrazek obrazek obrazek

Jan Krupa added 3 commits March 26, 2026 09:50
- Add tab_views.py with combined and typed tab view factories
- Combined tab shows all linked custom objects with actions, tags, column config, quick search
- Typed tabs show per-COT filtered view with bulk actions and per-field filters
- Auto-discover referenced models from app registry (never call get_model during registration)
- Support CO-to-CO tabs (custom objects referencing other custom objects)
- Badge callables use OR + distinct to avoid double-counting
- Add combined_tab.html and typed_tab.html templates
- Add typed_tab_slugs to default_settings in PluginConfig
- Call register_all_tabs() in ready() before super().ready()
- Call inject_co_urls() and deduplicate_registry() after super().ready()
- Add model_view_tabs to customobject.html for CO-to-CO tab support
- Fix JournalEntryTable and ObjectChangeTable: remove unsupported user kwarg
- Fix journal/changelog views to pass self.tab instead of string literals
- Add Related Object Tabs section explaining combined and typed tabs
- Document typed_tab_slugs PLUGINS_CONFIG setting with example
- Note that restart is required after config changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto generation of tabs in other objects that lists related Custom Objects

1 participant