Opened 15 years ago

Closed 15 years ago

#11653 closed (wontfix)

Manager not inherited in model inheritance

Reported by: Alex Robbins Owned by: nobody
Component: Database layer (models, ORM) Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have a base model that defines some published fields and has a manager that knows how to use them. When other models inherit from it, they get the fields. However, they don't get the manager. (It is intentionally left out http://code.djangoproject.com/browser/django/trunk/django/db/models/base.py#L73)

I know I can just set the manager explicitly on every child model, but that is the sort of thing I was hoping to avoid by using inheritance.

The knowledgeable jdunck explained that a new manager instance has to be made since managers know what model they are for, and the child models need a different manager instance than the parent. It isn't as simple as removing line 77 in the above code.

Still it'd be nice...

Change History (1)

comment:1 by dc, 15 years ago

Resolution: wontfix
Status: newclosed

This works as documented: Custom managers and model inheritance. Marking as wontfix, if you disagree please take this to the django-developers mailing list.

Note: See TracTickets for help on using tickets.
Back to Top