It specifies "By default, Django uses an instance of the
Model._base_manager manager class when accessing related objects (i.e.
choice.question), not the _default_manager on the related object."
But when accessing the set of related objects, i.e. question.choice_set,
it is the default manager that is used. This does not appear clearly in
the documentation.
--
Ticket URL: <https://code.djangoproject.com/ticket/31342>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* version: 2.2 => 3.0
* type: Uncategorized => Cleanup/optimization
* easy: 1 => 0
* stage: Unreviewed => Accepted
Comment:
Hi Benjamin.
This comes up every so often — it's hard stuff.
The docs have:
> Base managers aren’t used when querying on related models.
But I think the required information is really in the Making Queries topic
page. I've [https://github.com/django/django/pull/12531 suggested a PR]
adding a link back to the
[https://docs.djangoproject.com/en/3.0/topics/db/queries/#following-
relationships-backward Following relationships backward] section there.
Hopefully that's clearer.
Thanks for the report.
--
Ticket URL: <https://code.djangoproject.com/ticket/31342#comment:1>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/31342#comment:2>
* owner: nobody => Carlton Gibson
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31342#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"1c1911dcd9480ddc23a64703027cc78b379bc011" 1c1911d]:
{{{
#!CommitTicketReference repository=""
revision="1c1911dcd9480ddc23a64703027cc78b379bc011"
[3.0.x] Fixed #31342 -- Clarified docs about using base managers for
related objects.
Backport of 08a6215d334f88f16707278e6003af59d13345b4 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31342#comment:4>