Django-South DataMigration - is the application available in forward () but not backward ()?

I am writing django south migration, which is model dependent in another application, so I turned on --freeze OTHERAPPNAME when I ran python manage.py datamigration …

However, in the forwards() function, I can access another model (with orm['otherappname.MyModelName'] ), however, in the backwards() step (which also depends on the model in otherappname), if I try to access orm['otherappname.MyModelName'] , I get an error

 *** KeyError: "The model 'mymodelname' from the app 'otherappname' is not available in this migration." 

I see details of frozen models at the bottom of the file. Why can't I access it?

NB: this model is created in another migration inside oraprappname, on which this datamigration depends.

+6
source share
1 answer

In the opposite direction, the frozen ORM of the previous migration is actually used. This is logical when you think about it, but it is admittedly not very intuitive.

Moral: Freeze the models you need in your datamigration in a scheme that continues it.

+10
source

Source: https://habr.com/ru/post/909840/


All Articles