mirror of
https://github.com/django/django.git
synced 2025-08-23 18:29:12 +00:00
[1.5.x] Fixed #20612 -- Fixed incorrect wording in CBV documentation
Thanks to ndokos for the report. Backport of b53ed5ac55d5881f129c4921199af355e2b13565 from master.
This commit is contained in:
parent
843802ec26
commit
ee8996d8a6
@ -196,15 +196,12 @@ provided by the generic view. For example, think of showing a list of
|
|||||||
all the books on each publisher detail page. The
|
all the books on each publisher detail page. The
|
||||||
:class:`~django.views.generic.detail.DetailView` generic view provides
|
:class:`~django.views.generic.detail.DetailView` generic view provides
|
||||||
the publisher to the context, but how do we get additional information
|
the publisher to the context, but how do we get additional information
|
||||||
in that template.
|
in that template?
|
||||||
|
|
||||||
However, there is; you can subclass
|
The answer is to subclass :class:`~django.views.generic.detail.DetailView`
|
||||||
:class:`~django.views.generic.detail.DetailView` and provide your own
|
and provide your own implementation of the ``get_context_data`` method.
|
||||||
implementation of the ``get_context_data`` method. The default
|
The default implementation simply adds the object being displayed to the
|
||||||
implementation of this that comes with
|
template, but you can override it to send more::
|
||||||
:class:`~django.views.generic.detail.DetailView` simply adds in the
|
|
||||||
object being displayed to the template, but you can override it to send
|
|
||||||
more::
|
|
||||||
|
|
||||||
from django.views.generic import DetailView
|
from django.views.generic import DetailView
|
||||||
from books.models import Publisher, Book
|
from books.models import Publisher, Book
|
||||||
|
Loading…
x
Reference in New Issue
Block a user