Hello,
I'm trying to make a migration to change a field ("filter") from a ForeignKey to a CharField. The migration is as follow :
class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name='Rendition',
name='filter2',
field=models.CharField(max_length=255, db_index=True),
),
migrations.RunPython(forwards_data_migration, reverse_data_migration),
migrations.RemoveField(model_name='Rendition', name='filter'),
migrations.DeleteModel('Filter'),
migrations.RenameField(model_name='Rendition', old_name='filter2', new_name='filter'),
]
When running the migration, I have the following error:
django.core.exceptions.FieldDoesNotExist: Rendition has no field named u'filter'
The error happens during the RemoveField (migrations.RemoveField(model_name='Rendition', name='filter')).
So, a couple questions:
* Is there a better way to change a field type (with data migration)?
* Why do I have this error, when my field is present?
Thanks