Skip to content

Register additional tab to plugin model #11641

Answered by AcidSailor
Kani999 asked this question in Q&A
Discussion options

You must be logged in to vote

I didn't check the slack discussion, but eventually came up with the solution, so posting it here:

  1. You should use this in urls.py for your custom plugin (basically, get_model_urls seems to load all urls from registry)
include(get_model_urls(<app_label>, <model_name>)))

For example, how it's done in core models:

path('devices/<int:pk>/', include(get_model_urls('dcim', 'device'))),

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()

urls.py

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Kani999
Comment options

Answer selected by Kani999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants