Skip to content

Fix AttributeError on CO journal/changelog/contacts pages (#19) - #20

Merged
Kani999 merged 1 commit into
masterfrom
fix/19-str-tab-marker
Sep 14, 2026
Merged

Kani999 merged 1 commit into
masterfrom
fix/19-str-tab-marker

Conversation

@Kani999

@Kani999 Kani999 commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes a regression introduced in 2.6.0 in plugin_extra_tabs and removes a duplicate Contacts tab on custom-object pages.

Problem

The 2.6.0 (label, weight) active-tab fallback in plugin_extra_tabs assumed context["tab"] is always a ViewTab. However, netbox-custom-objects' journal, changelog, contacts and configcontext views set it to a plain str, so every such page raised:

'str' object has no attribute 'label'

whenever at least one combined/typed tab was registered for the CO model.

Additionally, the NetBox-auto-registered contacts ViewTab (features.py, since 4.3) was being picked up by plugin_extra_tabs. The CO template already renders Contacts by hand, so the registry entry produced a duplicate, never-active tab.

Changes

  • Read label/weight with getattr; a str marker now simply yields "not active" instead of raising.
  • Exclude the auto-registered contacts ViewTab from plugin_extra_tabs.
  • Bump version to 2.6.1.

The 2.6.0 (label, weight) active-tab fallback in plugin_extra_tabs assumed
context["tab"] is always a ViewTab, but netbox-custom-objects' journal,
changelog, contacts and configcontext views set it to a plain str, so every
such page raised "'str' object has no attribute 'label'" whenever at least
one combined/typed tab was registered for the CO model. Read label/weight
with getattr; a str marker now just yields "not active".

Also exclude the NetBox-auto-registered `contacts` ViewTab (features.py,
since 4.3) from plugin_extra_tabs: the CO template renders Contacts by hand,
so the registry entry produced a duplicate, never-active tab.

Release 2.6.1.
@Kani999
Kani999 merged commit 5e3809c into master Sep 14, 2026
2 checks passed
@Kani999
Kani999 deleted the fix/19-str-tab-marker branch September 14, 2026 08:46
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.

1 participant