From cb5ade07f0c71e97ddb2f02d84f387a9daf55ab6 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 10 Apr 2026 18:55:27 -0400 Subject: [PATCH] Closes #21887: Deprecate support for legacy view actions (#21889) --- netbox/netbox/views/generic/mixins.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/netbox/netbox/views/generic/mixins.py b/netbox/netbox/views/generic/mixins.py index 6e40e4175..2945e0e33 100644 --- a/netbox/netbox/views/generic/mixins.py +++ b/netbox/netbox/views/generic/mixins.py @@ -9,7 +9,7 @@ __all__ = ( 'TableMixin', ) -# TODO: Remove in NetBox v4.5 +# TODO: Remove in NetBox v4.7 LEGACY_ACTIONS = { 'add': object_actions.AddObject, 'edit': object_actions.EditObject, @@ -33,7 +33,7 @@ class ActionsMixin: """ actions = tuple() - # TODO: Remove in NetBox v4.5 + # TODO: Remove in NetBox v4.7 def _convert_legacy_actions(self): """ Convert a legacy dictionary mapping action name to required permissions to a list of ObjectAction subclasses. @@ -41,6 +41,14 @@ class ActionsMixin: if type(self.actions) is not dict: return + import warnings + warnings.warn( + f"{self.__class__.__name__}.actions is defined as a dictionary, which is deprecated and will be removed " + "in NetBox v4.7. Define actions as a list of ObjectAction subclasses instead.", + DeprecationWarning, + stacklevel=2, + ) + actions = [] for name in self.actions.keys(): try: @@ -56,7 +64,7 @@ class ActionsMixin: """ model = model or self.queryset.model - # TODO: Remove in NetBox v4.5 + # TODO: Remove in NetBox v4.7 # Handle legacy action sets self._convert_legacy_actions()