0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 01:46:24 +01:00

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.
This commit is contained in:
Sage Abdullah 2023-08-22 16:07:37 +01:00
parent 303ad4cb7e
commit 3cb897ca49
No known key found for this signature in database
GPG Key ID: EB1A33CC51CC0217

View File

@ -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)