From 1c1911dcd9480ddc23a64703027cc78b379bc011 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Thu, 5 Mar 2020 16:04:06 +0100 Subject: [PATCH] [3.0.x] Fixed #31342 -- Clarified docs about using base managers for related objects. Backport of 08a6215d334f88f16707278e6003af59d13345b4 from master --- docs/topics/db/managers.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/topics/db/managers.txt b/docs/topics/db/managers.txt index 1b34bea69b..aa41eb648d 100644 --- a/docs/topics/db/managers.txt +++ b/docs/topics/db/managers.txt @@ -214,11 +214,13 @@ appropriate for your circumstances, you can tell Django which class to use by setting :attr:`Meta.base_manager_name `. -Base managers aren't used when querying on related models. For example, if the -``Question`` model :ref:`from the tutorial ` had a ``deleted`` -field and a base manager that filters out instances with ``deleted=True``, a -queryset like ``Choice.objects.filter(question__name__startswith='What')`` -would include choices related to deleted questions. +Base managers aren't used when querying on related models, or when +:ref:`accessing a one-to-many or many-to-many relationship +`. For example, if the ``Question`` model +:ref:`from the tutorial ` had a ``deleted`` field and a base +manager that filters out instances with ``deleted=True``, a queryset like +``Choice.objects.filter(question__name__startswith='What')`` would include +choices related to deleted questions. Don't filter away any results in this type of manager subclass ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~