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
Updated by bmbouter almost 4 years ago
- Blocks Task #8182: Add an `AccessPolicy.customized` field to tell if a user has customized one or not added
Updated by pulpbot almost 4 years ago
- Status changed from NEW to POST
Added by bmbouter almost 4 years ago
Updated by bmbouter almost 4 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulpcore|d301f970b57e9424c906eb357830b53705fd9b0f.
Updated by pulpbot almost 4 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
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