diff --git a/docs/topics/class-based-views/mixins.txt b/docs/topics/class-based-views/mixins.txt
index 84d7417..2c5df87 100644
a
|
b
|
One way to do this is to combine :class:`ListView` with
|
286 | 286 | for the paginated list of books can hang off the publisher found as the single |
287 | 287 | object. In order to do this, we need to have two different querysets: |
288 | 288 | |
289 | | ``Publisher`` queryset for use in |
290 | | :meth:`~django.views.generic.detail.SingleObjectMixin.get_object()` |
291 | | We'll set the ``model`` attribute on the view and rely on the default |
292 | | implementation of ``get_object()`` to fetch the correct ``Publisher`` |
293 | | object. |
294 | | |
295 | 289 | ``Book`` queryset for use by :class:`~django.views.generic.list.ListView` |
296 | | The default implementation of ``get_queryset()`` uses the ``model`` attribute |
297 | | to construct the queryset. This conflicts with our use of this attribute |
298 | | for ``get_object()`` so we'll override that method and have it return |
299 | | the queryset of ``Book`` objects linked to the ``Publisher`` we're looking |
300 | | at. |
| 290 | Since we have access to the ``Publisher`` whose books we want to list, we |
| 291 | simply override ``get_queryset()`` and use the ``Publisher``'s |
| 292 | :ref:`reverse foreign key manager<backwards-related-objects>`. |
| 293 | |
| 294 | ``Publisher`` queryset for use in :meth:`~django.views.generic.detail.SingleObjectMixin.get_object()` |
| 295 | We'll rely on the default implementation of ``get_object()`` to fetch the |
| 296 | correct ``Publisher`` object. |
| 297 | However, we need to explicitely pass a ``queryset`` argument because |
| 298 | otherwise the default implementation of ``get_object()`` would call |
| 299 | ``get_queryset()`` which we have overridden to return ``Book`` objects |
| 300 | instead of ``Publisher`` ones. |
301 | 301 | |
302 | 302 | .. note:: |
303 | 303 | |
… |
… |
Now we can write a new ``PublisherDetail``::
|
317 | 317 | from books.models import Publisher |
318 | 318 | |
319 | 319 | class PublisherDetail(SingleObjectMixin, ListView): |
320 | | model = Publisher # for SingleObjectMixin.get_object |
321 | 320 | paginate_by = 2 |
322 | 321 | template_name = "books/publisher_detail.html" |
323 | 322 | |
324 | 323 | def get(self, request, *args, **kwargs): |
325 | | self.object = self.get_object() |
| 324 | self.object = self.get_object(queryset=Publisher.objects.all()) |
326 | 325 | return super(PublisherDetail, self).get(request, *args, **kwargs) |
327 | 326 | |
328 | 327 | def get_context_data(self, **kwargs): |