Closes #10608: Register all core model views using register_model_view()

This commit is contained in:
jeremystretch
2022-10-07 17:17:58 -04:00
parent f470f9620b
commit c042c7e166
16 changed files with 389 additions and 344 deletions

View File

@@ -167,7 +167,7 @@ class ViewTab:
return self.badge
def register_model_view(model, name, path=None, kwargs=None):
def register_model_view(model, name='', path=None, kwargs=None):
"""
This decorator can be used to "attach" a view to any model in NetBox. This is typically used to inject
additional tabs within a model's detail view. For example, to add a custom tab to NetBox's dcim.Site model:
@@ -182,7 +182,7 @@ def register_model_view(model, name, path=None, kwargs=None):
Args:
model: The Django model class with which this view will be associated.
name: The string used to form the view's name for URL resolution (e.g. via `reverse()`). This will be appended
to the name of the base view for the model using an underscore.
to the name of the base view for the model using an underscore. If blank, the model name will be used.
path: The URL path by which the view can be reached (optional). If not provided, `name` will be used.
kwargs: A dictionary of keyword arguments for the view to include when registering its URL path (optional).
"""