django model inherit custom manager
I cannot make a django model inherit a custom manager from its parent class. I have done something like the following:
class baseclassmanager(models.Manager): """manager for baseclass""" class baseclass(models.Model): """ baseclass for subclass introspection shows this class has a manager of type baseclassmanager """ objects = baseclassmanager() class subclass(baseclass): """ subclass introspection shows this class has a manager of type models.Manager I want it to have a baseclassmanager manager """
I can only imagine that this has something to do with how the metaclass builds the model. Does anybody have a way make the subclass inherit the baseclass's manager? dit seems as if inheritance of managers would be a fairly desirable feature.
Your assistance is appreciated.
The inheritance problem is solved by placing
class Meta: abstract = True
in the base class.