#27875: Manager inheritance for multi-table inheritance model behaviour -------------------------------------+------------------------------------- Reporter: ek-init | Owner: nobody Type: Bug | Status: new Component: | Version: 1.10 Uncategorized | Severity: Normal | Keywords: Manager inheritance Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- The Managers documentation says: > Managers from base classes are always inherited by the child class, using Python’s normal name resolution order (names on the child class override all others; then come names on the first parent class, and so on).
> If no managers are declared on a model and/or its parents, Django automatically creates the objects manager. For abstract base classes this works properly, inheriting the manager from the base model and therefore overriding the objects manager if so declared. For my non-abstract inheritance example, this does not work the same way ... {{{ #!python class MyManager(models.Manager): pass class A(models.Model): objects = MyManager() other = MyManager() class B(A): pass }}} {{{ In [4]: B.objects.__class__ Out[4]: django.db.models.manager.Manager In [5]: B.other.__class__ Out[5]: test_app.models.MyManager }}} -- Ticket URL: <https://code.djangoproject.com/ticket/27875> 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/050.9d493fbb93f92399ac2dd33865efc1ff%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.