1

So I had to reorganize my models ( had to do manual migrations) and in the end I had to rename some models and then I got an error, when I was running `manage.py migration:

The field Collect_data.Players.Team was declared with a lazy reference to 'xx.old_name', but app 'xxx' doesn't provide model 'old_name'.

the migration file:

    migrations.RenameModel(
        old_name='Old_name',
        new_name='new_name',
    ),

Now if look to the db, everything seems to be ok(renaming has been done) and all the connections are ok. If I open django shell, I can get the models with new names. Only problem is that I get this warning when I run server: "You have 1 unapplied migration(s)." and if I try to migrate, then I get a error that table already exists. If I run makemigartion I get same error as the first one said ( lazy reference... ). In migrations list I can see that the last migration doesn't have "X" on it's box. So how can I tell Django that everything is fine?

pinq-
  • 367
  • 2
  • 17

1 Answers1

4
python manage.py migrate --fake ####

This tells django to do a fake migration, basically check the migration checkbox without doing anything. '####' is the migration file number you want to fake it

Yellowduck
  • 482
  • 2
  • 4
  • This did the job. Thanks. Here is more info: https://stackoverflow.com/questions/30626886/how-to-redo-a-migration-on-django-1-8-after-using-fake – pinq- Nov 13 '19 at 11:31