Description
NetBox version
v4.2.4
Feature type
Change to existing functionality
Proposed functionality
With #18029 adding support for registering non-detail custom views via register_model_view(detail=False)
, would it be possible to also add support for adding tabs for these views (via the ViewTab
class)?
Currently, only ObjectView
uses the tab
field, so I presume this would have to be moved up one level to the BaseObjectView
/BaseMultiObjectView
classes, and the templates updated to dynamically insert the tabs similar to how generic/object.html
does:
{# Include tabs for registered model views #}
{% model_view_tabs object %}
(Since a non-detail view can either be a list, edit or delete view, it would probably be necessary to specify or identify what type of view we want to add the tab to?)
Use case
My plugin adds a "Quick Create" view with a custom form to make it easier to bulk create prefixes, IPs and interfaces for a specified device. I have registered my custom view as such:
@register_model_view(model=Prefix, name='quick_add', detail=False)
class PrefixQuickCreateView(View):
# ...
which makes it available under /ipam/prefixes/quick-add/
, however I'd also like to add a corresponding "Quick Create" custom tab which would show up when navigating to /ipam/prefixes/add/
(i.e PrefixEditView
)
Database changes
No response
External dependencies
No response