I have two models:
# app1
class ParentModel(models.Model):# some fields
Now, in another app, I have child model:
# app2
from app1.models import ParentModelclass ChildModel(ParentModel):# some fields here too
In initial migration for app2
django creates OneToOneField
with parent_link=True
named parentmodel_ptr
.
Now I want to change this auto generated field to let's say IntegerField
, so I create new migration with this operations:
class Migration(migrations.Migration):dependencies = [('app2', '0001_initial'),]operations = [migrations.AlterField('childmodel','parentmodel_ptr',models.IntegerField(null=True, blank=True))]
Trying to migrate, I got an exception
django.core.exceptions.FieldError: Auto-generated field 'parentmodel_ptr' in class 'ChildModel' for parent_link to base class 'ParentModel' clashes with declared field of the same name.
So is that even possible to make it somehow?