mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-21 04:42:22 -06:00
Closes #10608: Register all core model views using register_model_view()
This commit is contained in:
@@ -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).
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user