I have a following model and abstract base class

import abc
from django.db import models


class AbstractBase():
    __metaclass__ = abc.ABCMeta

    @abc.abstractmethod
    def my_method(self):
        return


class MyModel(models.Model, AbstractBase):
    @abc.abstractmethod
    def my_method(self):
        return 1

But I am getting the following error.

metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

I think the problem here is (As it is described here http://code.activestate.com/recipes/204197-solving-the-metaclass-conflict/) that two base class has two different metaclasses so python cannot decide which metaclass to use for child object.

In order to solve this I removed multiple inheritence and use following register method to register child class

abc.register(Child)

But I did not really like this approach since it looks like monkey patching.

Is there another way to solve this problem?

I try to assign Model metaclass to Child explicitly but it did not work. I am not looking for a way to solve it by writing code. I think this must be solved by changing my class structure.

Edit
Report