Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django-model-utils: does InheritanceManager work if the parent model/class is abstract?

django-model-utils. I'm attempting the very basic use of InhertianceManager as described in the docs.

nearby_places = Place.objects.filter(location='here').select_subclasses()

The only difference is that my parent model/class is abstract. Is this still supposed to work?

I am getting errors like

Caught DatabaseError while rendering: (1146, "Table 'proj.ParentModel' doesn't exist")

and

'Options' object has no attribute '_join_cache'

both of which are errors one typically gets when you attempt to do a query on an abstract class.

in my parent model i've defined the manager as follows:

class ParentModel(OrderedModel):
    objects = InheritanceManager()
like image 483
w-- Avatar asked Oct 08 '22 05:10

w--


1 Answers

following the link from the docs to Jeff Elmore's blog (aka the author of the InheritanceManager) he describes how InheritanceManager works.

It is quite clear that the parent model/class cannot be abstract.

.... actually i should have figured this out from the code the first time around.....

like image 176
w-- Avatar answered Oct 14 '22 00:10

w--