I am trying to define entity architecture that, if simplified, can be expressed like this:
class M(models.Model):
field_m = models.CharField(max_length=255)
class Meta:
abstract = True
class A(M):
field_a_1 = models.CharField(max_length=255)
field_a_2 = models.CharField(max_length=255)
class Meta:
abstract = True
class B(A):
field_b = models.CharField(max_length=255)
class Meta:
abstract = True
class C(A):
field_c = models.CharField(max_length=255)
class Meta:
abstract = True
class D(A):
field_d = models.CharField(max_length=255)
class Meta:
abstract = True
class DD(D):
class Meta:
abstract = True
class X(B, C, DD):
field_x = models.CharField(max_length=255)
pass
As you can see, X
has some mixins (abstract entitites). Each of the mixin has their own custom logic implemented inside them. But ultimately all of them have 1 common parent- abstract class A
.
As far as I understand, this should work. And MRO resolution, indeed, works. However, when starting the project I get 2 errors per each field field A
(that are inherited in X
):
X.field_m : (models.E006) The field 'field_m ' clashes with the field 'field_m ' from model 'X'.
X.field_m : (models.E006) The field 'field_m ' clashes with the field 'field_m ' from model 'X'.
X.field_a_1 : (models.E006) The field 'field_a_1 ' clashes with the field 'field_a_1 ' from model 'X'.
X.field_a_1 : (models.E006) The field 'field_a_1 ' clashes with the field 'field_a_1 ' from model 'X'.
X.field_a_2 : (models.E006) The field 'field_a_2 ' clashes with the field 'field_a_2 ' from model 'X'.
X.field_a_2 : (models.E006) The field 'field_a_2 ' clashes with the field 'field_a_2 ' from model 'X'.
I am working with Django 1.11