Opened 6 years ago
Closed 6 years ago
#29751 closed Bug (duplicate)
Saving deserialized objects in custom migration fails in certain cases
Reported by: | Kedar | Owned by: | Kedar |
---|---|---|---|
Component: | Migrations | Version: | 1.11 |
Severity: | Normal | Keywords: | serialize, deserialize, migration |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Saving deserialised objects in custom migration fails in certain cases (model has new fields added since) because _get_model
used here uses the latest version of the model (rather than the migration-specific model, which is derived using apps.get_model
where apps
is the first argument passed to a custom migration function - which is passed to migrations.RunPython
)
Fix here would be to pass the apps
received as first argument in a custom migration via the **options
in deserialize()
Change History (3)
comment:1 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 6 years ago
Component: | Database layer (models, ORM) → Migrations |
---|---|
Easy pickings: | unset |
comment:3 by , 6 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
I'd call this is a duplicate of #24778.
At first glance this seems plausible.
@0xKD: you've assigned yourself. Can you add a failing test case that reproduces the issue here?