Project

Profile

Help

Task #8203

closed

Fix all migrations to use `apps.get_model(...)` instead of directly importing the model

Added by bmbouter about 3 years ago. Updated about 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
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

Blocks Pulp - Task #8182: Add an `AccessPolicy.customized` field to tell if a user has customized one or notCLOSED - CURRENTRELEASEbmbouter

Actions

Also available in: Atom PDF