#34337: Documentation for custom related managers is contradictory
-------------------------------+--------------------------------------
Reporter: Adam Alton | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 4.1
Severity: Normal | Resolution: duplicate
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 Mariusz Felisiak):
* cc: Carlton Gibson (added)
* status: new => closed
* resolution: => duplicate
Comment:
> What? So Django uses a base manager for related objects, but base
managers aren't used for related objects?! I checked with a colleague and
they couldn't make sense of it either.
We have here two different things::
- accessing related fields e.g. `choice.question` where the
`Model._base_manager` manager class is used. This is because Django needs
to be able to retrieve the related object, even if it would otherwise be
filtered out (and hence be inaccessible) by the default manager (as
documented).
- filtering out related fields e.g.
`Choice.objects.filter(question__name__startswith='What')` where base
managers aren’t used.
Personally, I find the documentation quite clear, it contains examples
etc. I'm not sure how we could be clearer 🤔. Closing as a duplicate of
#31342.
Docs improvements are always welcome so feel-free to submit PR with a
concrete proposal and `Refs #31342 -- ...`.
--
Ticket URL: <https://code.djangoproject.com/ticket/34337#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/010701864e3af22e-851d1e27-0e79-419f-9ad3-a45c14d87912-000000%40eu-central-1.amazonses.com.