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
fix_request_path_info
Charlie Denton 2017-03-02 23:33:01 +00:00
parent a178ed751d
commit 8e52bdf6d1
No known key found for this signature in database
GPG Key ID: 5BBA1783DA191613
1 changed files with 2 additions and 0 deletions

View File

@ -196,6 +196,7 @@ if django.VERSION >= (1, 7):
class MROBase1(ShowFieldType, PolymorphicModel): class MROBase1(ShowFieldType, PolymorphicModel):
objects = MyManager() objects = MyManager()
base_1_id = models.AutoField(primary_key=True)
field1 = models.CharField(max_length=10) # needed as MyManager uses it field1 = models.CharField(max_length=10) # needed as MyManager uses it
@ -204,6 +205,7 @@ class MROBase2(MROBase1):
class MROBase3(models.Model): class MROBase3(models.Model):
base_3_id = models.AutoField(primary_key=True)
objects = PolymorphicManager() objects = PolymorphicManager()