Remove register_model_actions from public API

Meta.permissions is the documented approach for plugins. The
register_model_actions function is now an internal implementation
detail.
This commit is contained in:
Jason Novinger
2026-04-07 10:15:16 -05:00
parent 1ec9b5b135
commit 94612fd728
2 changed files with 0 additions and 28 deletions

View File

@@ -21,31 +21,4 @@ class MyModel(NetBoxModel):
]
```
For dynamic registration (e.g. when actions depend on runtime state), you can call `register_model_actions()` directly, typically in your plugin's `ready()` method:
```python
# __init__.py
from netbox.plugins import PluginConfig
class MyPluginConfig(PluginConfig):
name = 'my_plugin'
# ...
def ready(self):
super().ready()
from utilities.permissions import ModelAction, register_model_actions
from .models import MyModel
register_model_actions(MyModel, [
ModelAction('sync', help_text='Synchronize data from external source'),
ModelAction('export', help_text='Export data to external system'),
])
config = MyPluginConfig
```
Once registered, these actions appear as checkboxes in a flat list when creating or editing an ObjectPermission.
::: utilities.permissions.ModelAction
::: utilities.permissions.register_model_actions

View File

@@ -13,7 +13,6 @@ __all__ = (
'get_permission_for_model',
'permission_is_exempt',
'qs_filter_from_constraints',
'register_model_actions',
'resolve_permission',
'resolve_permission_type',
)