summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Miller <info@akmiller.co.uk>2024-12-13 16:44:53 +0000
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-18 13:08:14 +0100
commit0fc6d5362bfed3e2222fa3476139126ee08a4ff9 (patch)
treecfa2f94b4e07df2b787d0afb71e73a6a41795bdc
parentbb6114ce5094eca25c52a7a1a56156d512cba065 (diff)
Fixed #26007 -- Clarified SingleObjectTemplateResponseMixin.get_template_names() docs.
-rw-r--r--django/views/generic/detail.py5
-rw-r--r--docs/ref/class-based-views/mixins-single-object.txt5
2 files changed, 6 insertions, 4 deletions
diff --git a/django/views/generic/detail.py b/django/views/generic/detail.py
index a5f604bf1a..05ced1f25d 100644
--- a/django/views/generic/detail.py
+++ b/django/views/generic/detail.py
@@ -121,9 +121,10 @@ class SingleObjectTemplateResponseMixin(TemplateResponseMixin):
def get_template_names(self):
"""
Return a list of template names to be used for the request. May not be
- called if render_to_response() is overridden. Return the following list:
+ called if render_to_response() is overridden. Return a list containing
+ ``template_name``, if set on the value. Otherwise, return a list
+ containing:
- * the value of ``template_name`` on the view (if provided)
* the contents of the ``template_name_field`` field on the
object instance that the view is operating upon (if available)
* ``<app_label>/<model_name><template_name_suffix>.html``
diff --git a/docs/ref/class-based-views/mixins-single-object.txt b/docs/ref/class-based-views/mixins-single-object.txt
index 1378e10823..2e96422fc7 100644
--- a/docs/ref/class-based-views/mixins-single-object.txt
+++ b/docs/ref/class-based-views/mixins-single-object.txt
@@ -164,9 +164,10 @@ Single object mixins
.. method:: get_template_names()
- Returns a list of candidate template names. Returns the following list:
+ Returns a list of candidate template names. Return a list containing
+ ``template_name``, if set on the value. Otherwise, return a list
+ containing:
- * the value of ``template_name`` on the view (if provided)
* the contents of the ``template_name_field`` field on the
object instance that the view is operating upon (if available)
* ``<app_label>/<model_name><template_name_suffix>.html``