Explicitly name ids of clashing base models

This avoids the following error in django 1.11 tests:

    polymorphic.MRODerived: (models.E005) The field 'id' from parent model 'polymorphic.mrobase3' clashes with the field 'id' from parent model 'polymorphic.mrobase1'.

Related to https://code.djangoproject.com/ticket/22442
This commit is contained in:
Charlie Denton
2017-03-02 23:33:01 +00:00
parent a178ed751d
commit 8e52bdf6d1
+2
View File
@@ -196,6 +196,7 @@ if django.VERSION >= (1, 7):
class MROBase1(ShowFieldType, PolymorphicModel):
objects = MyManager()
base_1_id = models.AutoField(primary_key=True)
field1 = models.CharField(max_length=10) # needed as MyManager uses it
@@ -204,6 +205,7 @@ class MROBase2(MROBase1):
class MROBase3(models.Model):
base_3_id = models.AutoField(primary_key=True)
objects = PolymorphicManager()