From 3cb897ca49572f0495f2573a510005e8af634209 Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Tue, 22 Aug 2023 16:07:37 +0100 Subject: [PATCH] Rename ModelViewSet.get_template action param to name The param does not necessarily map to one of the views' name, and in fact can be a path relative to the template_prefix. --- wagtail/admin/viewsets/model.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wagtail/admin/viewsets/model.py b/wagtail/admin/viewsets/model.py index ff980ff877..280969b84a 100644 --- a/wagtail/admin/viewsets/model.py +++ b/wagtail/admin/viewsets/model.py @@ -147,7 +147,7 @@ class ModelViewSet(ViewSet): **self.get_delete_view_kwargs(), ) - def get_templates(self, action="index", fallback=""): + def get_templates(self, name="index", fallback=""): """ Utility function that provides a list of templates to try for a given view, when the template isn't overridden by one of the template @@ -156,9 +156,9 @@ class ModelViewSet(ViewSet): if not self.template_prefix: return [fallback] templates = [ - f"{self.template_prefix}{self.app_label}/{self.model_name}/{action}.html", - f"{self.template_prefix}{self.app_label}/{action}.html", - f"{self.template_prefix}{action}.html", + f"{self.template_prefix}{self.app_label}/{self.model_name}/{name}.html", + f"{self.template_prefix}{self.app_label}/{name}.html", + f"{self.template_prefix}{name}.html", ] if fallback: templates.append(fallback)