Actions
Task #8203
closedFix all migrations to use `apps.get_model(...)` instead of directly importing the model
Start date:
Due date:
% Done:
100%
Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:
Description
In various places in the migrations Models are imported directly and then used. This is a hazard for future changes because when the model definition changes this code can break. This happened recently with a change to the AccessPolicy model.
Django in their data migration docs recommend using apps.get_model(...) instead of importing the model directly. This will give you a historical model as of that point in time. We should switch our imports to use that instead.
Related issues
Actions
Fixes migration imports to use apps.get_model
In various places in the migrations Models are imported directly and then used. This is a hazard for future changes because when the model definition changes this code can break.
This PR switches data migrations to use apps.get_model(...) intead. It also fixes a syntax migration I noticed on the downmigrate in migration 50.
closes #8203