Working Ninja
2016-02-04T08:04:04
Abstract Classes and Multiple Inheritance in Django
class AbstractClass(models.Model):
    common_attribute = models.CharField()

    class Meta:
        abstract = True


class SpecializedClass(models.Model):
    specialized_attribute = models.CharField()

    class Meta:
        abstract = True


class AnotherSpecializedClass(models.Model):
    another_specialized_attribute = models.CharField()

    class Meta:
        abstract = True


class MultipleInheritance(AbstractClass, SpecializedClass):
    pass


class TripleMulitpleInheritance(AbstractClass, SpecializedClass, AnotherSpecializedClass):
    pass

Sources: https://docs.djangoproject.com/en/1.9/topics/db/models/#abstract-base-classes,
https://docs.djangoproject.com/en/1.9/topics/db/models/#multiple-inheritance