#30721: Implicit related objects filtration because of the set Manager.
-------------------------------------+-------------------------------------
Reporter: ApaDoctor | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):
* status: new => closed
* component: Uncategorized => Database layer (models, ORM)
* version: 2.2 => master
* resolution: => invalid
Comment:
Thanks for the report, IMO everything works properly, let's analyze this
step by step.
You inherited from `SomeAbstractModel` with a manager and define a
`custom_manager` in `SomeThing`. `custom_manager` is a default manager for
`SomeThing` that's why it's used by related manager (e.g. `x.children`).
In the same time `SomeThing` inherited `objects` manager from
`SomeAbstractModel` (it's no longer a default manager provided by Django,
see [https://docs.djangoproject.com/en/2.2/topics/db/managers/#manager-
names manager-names]) so when you call it explicit e.g.
`SomeThing.objects.filter(parent_id=1).count()` it returns all rows,
without an extra filter (see also
[https://docs.djangoproject.com/en/2.2/topics/db/managers/#custom-
managers-and-model-inheritance custom-managers-and-model-inheritance] and
[https://docs.djangoproject.com/en/2.2/topics/db/queries/#using-a-custom-
reverse-manager using-a-custom-reverse-manager]).
--
Ticket URL: <https://code.djangoproject.com/ticket/30721#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.253772dcc0c1ed67a0195c573321aa12%40djangoproject.com.