django-polymorphic icon indicating copy to clipboard operation
django-polymorphic copied to clipboard

Multiple Inheritance from PolymorphicModel

Open MiltosD opened this issue 5 years ago • 2 comments

class A(PolymorphicModel)

class B(PolymorphicModel)

class C(B)

class D(A, C)

When trying to make migrations for class D, I get the following The field 'polymorphic_ctype' from parent model 'A' clashes with the field 'polymorphic_ctype' from parent model 'B'.

Is there any way to differentiate between those two?

MiltosD avatar Nov 20 '19 14:11 MiltosD

Is there more to the error? Post the entire stack trace. I use the same setup in one of my apps, and have not encountered this.

JackAtOmenApps avatar May 03 '20 08:05 JackAtOmenApps

class Subscriptible(PolymorphicModel):
    subscribers = djm.ManyToManyField(User)

class Postable(PolymorphicModel):
    author = djm.ForeignKey(settings.AUTH_USER_MODEL)

class Answer(Postable, Subscriptible):
    pass

Answer: (models.E005) The field 'polymorphic_ctype' from parent model 'postable' clashes with the field 'polymorphic_ctype' from parent model 'subscriptible'.

Issue #429 could be relevant

claudioap avatar Sep 04 '20 15:09 claudioap