Opened 6 years ago

Closed 6 years ago

#11653 closed (wontfix)

Manager not inherited in model inheritance

Reported by: alexr 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: UI/UX:

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 Changed 6 years ago by dc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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