From 2ed6e14c1135c2ea320f027263ca8e6ff8162146 Mon Sep 17 00:00:00 2001 From: Renato Almeida de Oliveira Zaroubin Date: Tue, 25 Mar 2025 01:19:05 +0000 Subject: [PATCH] Add plugin support to GetReturnURLMixin --- netbox/utilities/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netbox/utilities/views.py b/netbox/utilities/views.py index b9a5f85fb..eac3465cb 100644 --- a/netbox/utilities/views.py +++ b/netbox/utilities/views.py @@ -150,8 +150,12 @@ class GetReturnURLMixin: # Attempt to dynamically resolve the list view for the object if hasattr(self, 'queryset'): model_opts = self.queryset.model._meta + is_plugin = isinstance(self.queryset.model._meta.app_config, PluginConfig) try: - return reverse(f'{model_opts.app_label}:{model_opts.model_name}_list') + if is_plugin: + return reverse(f'plugins:{model_opts.app_label}:{model_opts.model_name}_list') + else: + return reverse(f'{model_opts.app_label}:{model_opts.model_name}_list') except NoReverseMatch: pass