Search code examples
djangodjango-modelsdjango-nonrel

Django-Nonrel: Multi-table inheritance is not supported by non-relational DBs


I have a meta class named MyModel.

I also have 2 regular model classes named Node and Author. Author inherits from MyModel, and Node does not. (Node and Author work fine as expected.)

I want to change Node so that it also inherits from MyModel. When I try to change Node so that it also inherits from MyModel , I get the following error:

 raise DatabaseError("Multi-table inheritance is not "
TemplateSyntaxError: Caught DatabaseError while rendering: Multi-table inheritance is not supported by non-relational DBs.

I deleted all Node objects from the database, but I still get the error. Effectively, I want to delete Node and re-implement it. How can I get the database to recognize that Node should inherit from MyModel?


Solution

  • Multi-table inheritance is not supported by django-nonrel.

    If MyModel inherits from django.db.models.Model and Node and Author inherit from MyModel, then you have a multi table inheritance (even if MyModel has no fields).

    You can avoid this by making MyModel an abstract base class.