Replies: 1 comment
-
I didn't check the slack discussion, but eventually came up with the solution, so posting it here:
include(get_model_urls(<app_label>, <model_name>))) For example, how it's done in core models: Line 191 in 0e34fba 2. Or you also can do it "manually", for me it was: views.py
@register_model_view(
models.ProviderService,
name="contacts",
)
class ProviderServiceContactsView(ObjectContactsView):
queryset = models.ProviderService.objects.all()
urlpatterns = (
path("provider-services/<int:pk>/",
views.ProviderServiceView.as_view(), name="providerservice"),
path("provider-services/<int:pk>/edit/", views.ProviderServiceEditView.as_view(),
name="providerservice_edit"),
path("provider-services/<int:pk>/delete/", views.ProviderServiceDeleteView.as_view(),
name="providerservice_delete"),
path("provider-services/<int:pk>/changelog/", ObjectChangeLogView.as_view(),
kwargs={"model": models.ProviderService}, name="providerservice_changelog"),
# Without this line, custom tab was not working:
path("provider-services/<int:pk>/contacts/", views.ProviderServiceContactsView.as_view(),
name="providerservice_contacts"),
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
i'm trying to register additional tab ( https://docs.netbox.dev/en/stable/plugins/development/views/#additional-tabs ) to my plugin model.
Examples:
Contract
But the tab does not render on the object page.
The
registry
seems fineThe only tab which is displayed is
Changelog
Registering tabs to "Core" models, like "Device" works fine.
Are there some caveats, that I cannot add tabs to my plugin?
Or should I add something to my models, views, etc?
I create a discussion on slack, where I tried several things.
https://netdev-community.slack.com/archives/C03Q7A8C0TS/p1675324918322649
Beta Was this translation helpful? Give feedback.
All reactions