Skip to content

Adding additional custom tabs to non-detail views #18786

Closed as not planned
Closed as not planned
@aa659

Description

@aa659

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending closureRequires immediate attention to avoid being closed for inactivitystatus: under reviewFurther discussion is needed to determine this issue's scope and/or implementationtype: featureIntroduction of new functionality to the application

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions