mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-28 19:36:26 -06:00
Add plugin support to GetReturnURLMixin
This commit is contained in:
parent
bd8e00a935
commit
2ed6e14c11
@ -150,8 +150,12 @@ class GetReturnURLMixin:
|
|||||||
# Attempt to dynamically resolve the list view for the object
|
# Attempt to dynamically resolve the list view for the object
|
||||||
if hasattr(self, 'queryset'):
|
if hasattr(self, 'queryset'):
|
||||||
model_opts = self.queryset.model._meta
|
model_opts = self.queryset.model._meta
|
||||||
|
is_plugin = isinstance(self.queryset.model._meta.app_config, PluginConfig)
|
||||||
try:
|
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:
|
except NoReverseMatch:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user