#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 loic):
OK this boils down to `AbstractEvent.events` being inherited by
`MessyBachelorParty` despite having `BachelorParty` in between, hence why
`AbstractEvent.objects` doesn't exist.
There is a design question here, should models inherit from managers of
abstract models no matter what, or should we consider inheritance must
stop when it hits a concrete parents.
Since Django inheritance mimics Python inheritance to a large degree I
wonder more and more if we shouldn't always copy managers and revise the
docs. #25897 tries to enforce the documented behaviour by masking managers
at runtime, but that's fighting against standard Python inheritance (which
doesn't support private members).
Can anyone see downsides to inheriting managers from concrete parents?
--
Ticket URL: <https://code.djangoproject.com/ticket/20932#comment:10>
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.54f11bde2b4cb5c58aee81b40e3e5aff%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.