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.

Answers


The inheritance problem is solved by placing

class Meta:
    abstract = True

in the base class.


Need Your Help

Wondering the difference between 'with' and 'view' in SQL

sql view common-table-expression temp-tables

So I believe that in SQL if I want to temporary create a new table and use to make some queries, I can use CREATE VIEW which would make a "virtual table" with no physical data but can be used to qu...

Is it a good practice to build a collection cache?

caching mongodb node.js collections

I'm experiencing with MongoDB with Node.js using the plugin node-mongodb-native. A problem I'm experiencing is the amount of nested callbacks. I'm trying to simplify a few things by lessening the c...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.