views:

29

answers:

2

I have 2 models:

class A(Model):
    #Some Fields
    objects = ClassAManager()

class B(A):
    #Some B-specific fields

I would expect B.objects to give me access to an instance of ClassAManager, but this is not the case....

>>> A.objects
<app.managers.ClassAManager object at 0x103f8f290>
>>> B.objects
<django.db.models.manager.Manager object at 0x103f94790>

Why doesn't B inherit the objects attribute from A?

A: 

The documentation for Managers explains this in detail.

Daniel Roseman
I'm really more interested in a discussion of why this is the default behavior, but I should have made that more clear. Personally, I don't really agree with it.
Zach
A: 

Your base class will need to be an abstract base class in order for the custom manager to be inherited, as described here

Derrick Marcey