Python 3, Django 1.8.5, Postgres
I have a model Sites that has been working fine. I recently tried to add a field, airport_code, and migrate the data.>
I ran into this problem recently after upgrading to Django 1.11. I wanted to permanently address the issue so I wouldn't have to comment / uncomment code every time I ran a migration on the table, so my approach:
from django.db.utils import ProgrammingError as AvoidDataMigrationError
try:
... do stuff that breaks migrations
except AvoidDataMigrationError:
pass
I rename the exception during import to AvoidDataMigrationError so it's clear why it's there.