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:
parent
303ad4cb7e
commit
3cb897ca49
@ -147,7 +147,7 @@ class ModelViewSet(ViewSet):
|
|||||||
**self.get_delete_view_kwargs(),
|
**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
|
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
|
view, when the template isn't overridden by one of the template
|
||||||
@ -156,9 +156,9 @@ class ModelViewSet(ViewSet):
|
|||||||
if not self.template_prefix:
|
if not self.template_prefix:
|
||||||
return [fallback]
|
return [fallback]
|
||||||
templates = [
|
templates = [
|
||||||
f"{self.template_prefix}{self.app_label}/{self.model_name}/{action}.html",
|
f"{self.template_prefix}{self.app_label}/{self.model_name}/{name}.html",
|
||||||
f"{self.template_prefix}{self.app_label}/{action}.html",
|
f"{self.template_prefix}{self.app_label}/{name}.html",
|
||||||
f"{self.template_prefix}{action}.html",
|
f"{self.template_prefix}{name}.html",
|
||||||
]
|
]
|
||||||
if fallback:
|
if fallback:
|
||||||
templates.append(fallback)
|
templates.append(fallback)
|
||||||
|
Loading…
Reference in New Issue
Block a user