#20932: Issues with model Manager and inheritance.
-------------------------------------+-------------------------------------
Reporter: loic84 | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by ar45):
Replying to [comment:7 loic]:
> Investigated the first issue a bit more and updated the ticket
description with the findings. I don't think it's addressed by PR
https://github.com/django/django/pull/5797.
>
> Currently `MessyBachelorParty.objects` is the wrongly inherited manager
from `BachelorParty`.
>
> With the fix from the PR (after the deprecation period),
`MessyBachelorParty.objects` would raise an `AttributeError`, but the
expected behaviour would be that `MessyBachelorParty` gets an implicit
`objects = models.Manager()` created automatically.
After the deprecation period, the class setup in `ModelBase` will not find
any existing managers -- so `new_class._prepare()` which calls
`ensure_default_manager()` will create an implicit manager. So
`MessyBachelorParty` will get an implicit `objects = models.Manager()`
--
Ticket URL: <https://code.djangoproject.com/ticket/20932#comment:8>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.90e7dd5280b244399efc026f6f688ff7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.