Add get_model_urls() reference to register views included in NetBoxModel #10137

Closed
opened 2025-12-29 21:27:19 +01:00 by adam · 2 comments
Owner

Originally created by @dandunbar23 on GitHub (Aug 23, 2024).

Originally assigned to: @alehaa on GitHub.

Change Type

Addition

Area

Plugins

Proposed Changes

When subclassing NetBoxModel, the Journaling MixIn is automatically included in a new model. However, it took me a while to figure out how to include that tab in the detail view of the model and extend the URL. It requires:

from django.urls import path, include
from utilities.urls import get_model_urls

urlpatterns = (
    # Standard URL Patterns

    path("[seturl]/<int:pk>/", include(get_model_urls("[plugin_name]", "[model_name]")),),
)

This may be obvious to those who have more Django programming experience than I do, but I think it would be a worthwhile addition to the plugin development documentation to help people take advantage of the included MixIns.

Originally created by @dandunbar23 on GitHub (Aug 23, 2024). Originally assigned to: @alehaa on GitHub. ### Change Type Addition ### Area Plugins ### Proposed Changes When subclassing NetBoxModel, the Journaling MixIn is automatically included in a new model. However, it took me a while to figure out how to include that tab in the detail view of the model and extend the URL. It requires: ``` from django.urls import path, include from utilities.urls import get_model_urls urlpatterns = ( # Standard URL Patterns path("[seturl]/<int:pk>/", include(get_model_urls("[plugin_name]", "[model_name]")),), ) ``` This may be obvious to those who have more Django programming experience than I do, but I think it would be a worthwhile addition to the plugin development documentation to help people take advantage of the included MixIns.
adam added the status: acceptedtype: documentationnetbox labels 2025-12-29 21:27:19 +01:00
adam closed this issue 2025-12-29 21:27:20 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (May 9, 2025):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (May 9, 2025): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/main/CONTRIBUTING.md).
Author
Owner

@alehaa commented on GitHub (May 9, 2025):

I volunteer for this PR.

@alehaa commented on GitHub (May 9, 2025): I volunteer for this PR.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10137