1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Docs and test for #9072

This commit is contained in:
jeremystretch
2022-10-07 15:03:52 -04:00
parent 1fc8de85a3
commit 053c97b7a8
7 changed files with 59 additions and 2 deletions

View File

@@ -137,6 +137,12 @@ class ViewTab:
"""
ViewTabs are used for navigation among multiple object-specific views, such as the changelog or journal for
a particular object.
Args:
label: Human-friendly text
badge: A static value or callable to display alongside the label (optional). If a callable is used, it must accept a single
argument representing the object being viewed.
permission: The permission required to display the tab (optional).
"""
def __init__(self, label, badge=None, permission=None):
self.label = label
@@ -178,7 +184,7 @@ def register_model_view(model, name, path=None, kwargs=None):
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.
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)
kwargs: A dictionary of keyword arguments for the view to include when registering its URL path (optional).
"""
def _wrapper(cls):
app_label = model._meta.app_label