#30222: documentation bug for base managers -------------------------------+-------------------------------------- Reporter: David Gudeman | Owner: nobody Type: Bug | Status: closed Component: Documentation | Version: 2.1 Severity: Normal | Resolution: invalid Keywords: base_manager | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------------------------- Changes (by Carlton Gibson):
* status: new => closed * resolution: => invalid Comment: Grrr... Hi David. Can I first say, you pretty much want to forget this bit of the docs exists — unless you're super sure what you're doing, and even then, leave `_base_manager` well alone. (TBH not sure why it's documented the `_` prefix implies private method... — NoteToSelf: should look up why it's documented) The key point is that the `.filter(question__name__startswith)` bit, as a query, will use `Question._default_manager` even though the `choice.question` lookup, as a direct access, will use `_base_manager`. Have a read of (some of) [https://github.com/django/django/blob/master/django/db/models/fields/related_descriptors.py `django/db/models/fields/related_descriptors.py`] to see where `_base_manager` is used in this way. (Imagine you have a foreign key to an object filtered by `_default_manager` 💥...) I'm not sure this is really addressable. Bar a big warning banner saying "Here be dragons" I don't think there's much we can do to clarify this. (But concrete suggestions always to be considered...) -- Ticket URL: <https://code.djangoproject.com/ticket/30222#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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/071.b2e0bc4d186a74bdd14430719ff9fcd0%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.