When I perform a migration on one of my projects app I get the following error:
ValueError: Unhandled pending operations for models: common.shipmentaddress (referred to by fields: catalog.Fulfillment.address)
Django 1.9, python 2.7.10
I was looking for cyclic import but i don't think this is it
These are the models:
class ShipmentAddress(models.Model):
recipient_first_name = models.CharField(max_length=50, null=True, blank=True)
recipient_last_name = models.CharField(max_length=50, null=True, blank=True)
street_name = models.CharField(max_length=50)
state = models.ForeignKey(State)
postal_code = models.IntegerField(default=0)
city = models.CharField(max_length=50)
class Meta:
db_table = 'shipment_address'
class Fulfillment(models.Model):
address = models.ForeignKey(ShipmentAddress)
inventory_items = models.ManyToManyField(Item_With_Size, through='Inventory_Item')
class Meta:
verbose_name = 'fulfilment'
verbose_name_plural = 'fulfilments'
db_table = 'fulfilment'
The migrations looks like that:
class Migration(migrations.Migration):
dependencies = [
('catalog', '0009_auto_20151130_1118'),
]
operations = [
migrations.AlterField(
model_name='fulfillment',
name='address',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='common.ShipmentAddress'),
),
]
class Migration(migrations.Migration):
dependencies = [
('common', '0005_shipmentaddress'),
]
operations = [
migrations.RenameField(
model_name='shipmentaddress',
old_name='recipient_name',
new_name='recipient_first_name',
),
migrations.AddField(
model_name='shipmentaddress',
name='recipient_last_name',
field=models.CharField(blank=True, max_length=50, null=True),
),
]
common
andcatalog
apps, and the full traceback? – Krasnoyarsk