Skip to content

Commit

Permalink
Fixed #26007 -- Clarified SingleObjectTemplateResponseMixin.get_templ…
Browse files Browse the repository at this point in the history
…ate_names() docs.
  • Loading branch information
nanorepublica authored and sarahboyce committed Dec 18, 2024
1 parent bb6114c commit 0fc6d53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions django/views/generic/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``
Expand Down
5 changes: 3 additions & 2 deletions docs/ref/class-based-views/mixins-single-object.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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``

0 comments on commit 0fc6d53

Please sign in to comment.