Add a solution for RunPython import errors

This commit is contained in:
David Wobrock committed 2021-12-20 22:03:28 +01:00
1 parent fbd4b2971f
commit 4e279a9450
1 file changed
+2
+2
View File
@@ -171,6 +171,8 @@ Instead, once you use the `apps.get_model` function, if the first argument of yo
However, in a migration, you should be using the version of the model, at the point in time where this migration was created.
It could happen that you use a `RunPython` operation to fill a new column. But if you import that latest version of the model, this column might not exist anymore, which will break a prior migration.
:white_check_mark: **Solution**: use `apps.get_model` to get the model class
### Others
To be added...