use get_viewname instead of resolving the name

This commit is contained in:
Renato Almeida de Oliveira Zaroubin 2025-03-27 01:08:49 +00:00
parent 2ed6e14c11
commit babea07176

View File

@ -149,13 +149,8 @@ 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:
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')
return reverse(get_viewname(self.queryset.model, 'list'))
except NoReverseMatch:
pass